Message416518
Guido (msg416498)
> Surely the bigger issue is that the contents of new_code itself must be totally different? Also there are other tables that need to be adjusted if you really do change co_code, e.g. the debugging tables.
Do you consider that .replace() must reject changing co_code if other tables are not updated?
Debugging tables are not strictly required just to *execute* code, no?
If you consider that the caller *must* update co_exceptiontable, replace() must raise an exception in this case, to prevent creating a code object which would behave in a strange way (broken exception handling).
If someone really wants testing an empty exception table just for fun, it would still be possible to pass co_exceptiontable=b''.
My concern is more about people upgrading to Python 3.11 and who "suddenly" don't get their exceptions handled anymore. I would prefer catching such bug at the replace() call, rather than having to execute the code (and only notice the bug in production? oops). |
|
Date |
User |
Action |
Args |
2022-04-01 20:38:46 | vstinner | set | recipients:
+ vstinner, gvanrossum, Mark.Shannon |
2022-04-01 20:38:46 | vstinner | set | messageid: <1648845526.82.0.282401294912.issue47185@roundup.psfhosted.org> |
2022-04-01 20:38:46 | vstinner | link | issue47185 messages |
2022-04-01 20:38:46 | vstinner | create | |
|