FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-99537: Use Py_SETREF() function in C code by vstinner · Pull Request #99657 · python/cpython · GitHub

/ cpython Public

gh-99537: Use Py_SETREF() function in C code - #99657

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:py_only_setref2
Nov 22, 2022
Merged

gh-99537: Use Py_SETREF() function in C code#99657
vstinner merged 1 commit into
python:mainfrom
vstinner:py_only_setref2

Conversation

vstinner commented Nov 21, 2022
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

Fix potential race condition in code patterns:

  • Replace "Py_DECREF(var); var = new;" with "Py_SETREF(var, new);"
  • Replace "Py_XDECREF(var); var = new;" with "Py_XSETREF(var, new);"
  • Replace "Py_CLEAR(var); var = new;" with "Py_XSETREF(var, new);"

Other changes:

  • Replace "old = var; var = new; Py_DECREF(var)" with "Py_SETREF(var, new);"
  • Replace "old = var; var = new; Py_XDECREF(var)" with "Py_XSETREF(var, new);"
  • And remove the "old" variable.

Fix potential race condition in code patterns:

* Replace "Py_DECREF(var); var = new;" with "Py_SETREF(var, new);"
* Replace "Py_XDECREF(var); var = new;" with "Py_XSETREF(var, new);"
* Replace "Py_CLEAR(var); var = new;" with "Py_XSETREF(var, new);"

Other changes:

* Replace "old = var; var = new; Py_DECREF(var)"
  with "Py_SETREF(var, new);"
* Replace "old = var; var = new; Py_XDECREF(var)"
  with "Py_XSETREF(var, new);"
* And remove the "old" variable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL