Git Product home page Git Product logo

Comments (11)

MatthieuDartiailh avatar MatthieuDartiailh commented on July 19, 2024

Thanks for the report. Could you make a PR adding LOAD_CONST to _stack_effects so that we avoid the offending call ? Add a test and an entry in the changlog.

from bytecode.

thautwarm avatar thautwarm commented on July 19, 2024

Very glad to do that. I'll make it done.

from bytecode.

serhiy-storchaka avatar serhiy-storchaka commented on July 19, 2024

I can't reproduce the error. What python version do you use?

from bytecode.

MatthieuDartiailh avatar MatthieuDartiailh commented on July 19, 2024

I did not have time to try to reproduce but the line 34 in _opcode.c seemed like a possible reason for the error:

oparg_int = (int)PyLong_AsLong(oparg);

from bytecode.

thautwarm avatar thautwarm commented on July 19, 2024

@serhiy-storchaka This 0xFFFFFFFF...

from bytecode.

thautwarm avatar thautwarm commented on July 19, 2024

And I'm using Python 3.6.5 in Windows 10 x86_64.

from bytecode.

thautwarm avatar thautwarm commented on July 19, 2024

@MatthieuDartiailh Yes, you're right! (int)PyLong_AsLong(oparg) causes this, but note that standard compiler could even compile 0xFFFFFFFFFF..

I've found the way to solve this problem, a few minutes.

from bytecode.

serhiy-storchaka avatar serhiy-storchaka commented on July 19, 2024

I am not sure that specifying a whitelist for opcodes whose stack effect depends on its argument is a good approach. The list is not complete. It lacks following opcodes: BUILD_LIST, BUILD_LIST_UNPACK, BUILD_MAP_UNPACK, BUILD_SET, BUILD_SET_UNPACK, BUILD_TUPLE, BUILD_TUPLE_UNPACK, BUILD_TUPLE_UNPACK_WITH_CALL, CALL_FUNCTION_VAR, CALL_FUNCTION_VAR_KW, MAKE_CLOSURE. Also in new Python versions new opcodes can be added, and the meaning of old opcodes can be changed.

Are there other opcodes that need a workaround besides LOAD_CONST?

from bytecode.

serhiy-storchaka avatar serhiy-storchaka commented on July 19, 2024

#41 addresses this.

from bytecode.

MatthieuDartiailh avatar MatthieuDartiailh commented on July 19, 2024

Thanks for the ping @serhiy-storchaka . Actually I probably was in too much of a rush when reviewing the #43.
Looking through Python opcode and our implementation, I believe you are correct that only LOAD_CONST can manipulate arbitrary objects. And limiting the workaround to this one seems safer. I will review your PR sometimes next week. I want in particular to understand the need for the modified tests.
Thanks again for catching this.

from bytecode.

serhiy-storchaka avatar serhiy-storchaka commented on July 19, 2024

I have extracted the fix for this issue into separate PR #44.

from bytecode.

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.