Coder Social home page Coder Social logo

Comments (10)

ahyatt avatar ahyatt commented on July 18, 2024

I'm not sure I understand the gist. Those are my tests, but I don't see that my tests are doing anything with testing out powers of 2. For instance, in the first broken test, websocket-encode-frame, I just test out encoding strings of length 200 and 7000. But your test seems to be doing something else. Am I missing something?

Also, the error with parsing 4294967296 seems plausible, at least when byte-compiling. I'll fix that somehow.

from emacs-websocket.

tkf avatar tkf commented on July 18, 2024

I think you can see that some integer is overflowing in the websocket-to-bytes test. Don't you think overflow can break some test cases, because you are using a big number which cannot represented in the integer object?

In Emacs 23.1:

Test websocket-to-bytes condition:
    (ert-test-failed
     ((should
       (equal 70000
          (websocket-get-bytes ... 8)))
      :form
      (equal 70000 -300647710720000.0)
      :value nil :explanation
      (different-types 70000 -300647710720000.0)))

In Emacs 24.1:

Test websocket-to-bytes condition:
    (wrong-type-argument integerp 1.6298145055770874e-05)

BTW, these difference is maybe from this change in 23.2:

* Incompatible Lisp Changes in Emacs 23.2

** The Lisp reader turns integers that are too large/small into floats.
For instance, on machines where `536870911' is the largest integer,
reading `536870912' gives the floating-point object `536870912.0'.

This change only concerns the Lisp reader; it does not affect how
actual integer objects overflow.

-- http://www.gnu.org/software/emacs/NEWS.23.2 (via http://stackoverflow.com/questions/2975653)

from emacs-websocket.

ahyatt avatar ahyatt commented on July 18, 2024

That's really interesting, thanks for finding that issue. Yeah, I understand the issue, just not that gist. I'm working on replacing things with calc in appropriate places. It will slow some things down, but hopefully sending packets that are longer than ~4GB long is going to rare.

from emacs-websocket.

tkf avatar tkf commented on July 18, 2024

Thanks!

from emacs-websocket.

ahyatt avatar ahyatt commented on July 18, 2024

Should be fixed in cf885f0. Since I can't reproduce the issue, please re-open this bug if it does not fix the issue.

from emacs-websocket.

gcr avatar gcr commented on July 18, 2024

...Amazing. I literally found emacs-ipython-notebook minutes before you fixed this bug.

Your fix works for me. Arch linux 32-bit, Emacs 23.1. Before, (require 'websocket) would fail with load-with-code-conversion: Arithmetic overflow error: "4294967296"

With latest master, it works fine.

Thanks.

from emacs-websocket.

ahyatt avatar ahyatt commented on July 18, 2024

@tkf, also if you find that this fixes your users issues (such as it seems to have done for @gcr, yay), then I'll update the version number.

from emacs-websocket.

tkf avatar tkf commented on July 18, 2024

Wow, that's super fast! Unfortunately I can't access 32-bit machine now. I will tell the result when check it.

@gcr, thanks for checking and comment! I guess then it should work on my machine.

from emacs-websocket.

epatters avatar epatters commented on July 18, 2024

websocket.el now loads without error on my 32-bit system also. At one point, I did get an Arithmetic error while using emacs-ipython-notebook, but I have not been able to reproduce it. I will report back if I encounter more problems.

from emacs-websocket.

tkf avatar tkf commented on July 18, 2024

I tweaked test to run it in 32-bit system. Please check #19. It seems that websocket.el itself works properly.

from emacs-websocket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.