Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-42979: Use _Py_CheckSlotResult() to check slots result #24356

Merged
merged 1 commit into from
Jan 29, 2021
Merged

bpo-42979: Use _Py_CheckSlotResult() to check slots result #24356

merged 1 commit into from
Jan 29, 2021

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jan 28, 2021

When Python is built in debug mode (with C assertions), calling a
type slot like sq_length (len() in Python) now fails with a fatal
error if the slot succeeded with an exception set, or failed with no
exception set.

  • Check the result of all slots using _Py_CheckSlotResult().
  • No longer pass op_name to ternary_op() in release mode.
  • Replace operator with dunder Python method name in error messages.
    For example, replace "*" with "mul".
  • Fix compiler_exit_scope() when an exception is set.
  • Fix bytearray.extend() when an exception is set: don't call
    bytearray_setslice() with an exception set.

https://bugs.python.org/issue42979

When Python is built in debug mode (with C assertions), calling a
type slot like sq_length (__len__() in Python) now fails with a fatal
error if the slot succeeded with an exception set, or failed with no
exception set. The error message contains the slot, the type name,
and the current exception (if an exception is set).

* Check the result of all slots using _Py_CheckSlotResult().
* No longer pass op_name to ternary_op() in release mode.
* Replace operator with dunder Python method name in error messages.
  For example, replace "*" with "__mul__".
* Fix compiler_exit_scope() when an exception is set.
* Fix bytearray.extend() when an exception is set: don't call
  bytearray_setslice() with an exception set.
@vstinner vstinner added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jan 29, 2021
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @vstinner for commit a7eb557 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jan 29, 2021
@vstinner
Copy link
Member Author

Replace operator with dunder Python method name in error messages. For example, replace "*" with "mul".

Note for myself: I reverted this change, since the operator was part of some TypeError error messages.

@vstinner
Copy link
Member Author

buildbot/AMD64 FreeBSD Shared PR

"3 tests failed again: test_gdb test_subprocess test_venv"

These errors seem to be unrelated to my PR.

@vstinner
Copy link
Member Author

I didn't some basic sanity tests and they completed successfully:

  • create a venv
  • install cinder and run ./env/bin/python -m cinder.service (I had to fix two minor Python 3.10 issues in eventlet and oslo.context)
  • pip commands: cache dir, cache info, cache list, freeze, install -U pip

@vstinner vstinner merged commit a619263 into python:master Jan 29, 2021
@vstinner vstinner deleted the more_slot_assert branch January 29, 2021 15:53
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
…24356)

When Python is built in debug mode (with C assertions), calling a
type slot like sq_length (__len__() in Python) now fails with a fatal
error if the slot succeeded with an exception set, or failed with no
exception set. The error message contains the slot, the type name,
and the current exception (if an exception is set).

* Check the result of all slots using _Py_CheckSlotResult().
* No longer pass op_name to ternary_op() in release mode.
* Replace operator with dunder Python method name in error messages.
  For example, replace "*" with "__mul__".
* Fix compiler_exit_scope() when an exception is set.
* Fix bytearray.extend() when an exception is set: don't call
  bytearray_setslice() with an exception set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants