← 返回首页
bpo-15999: Clean up of handling boolean arguments. by serhiy-storchaka · Pull Request #15610 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

bpo-15999: Clean up of handling boolean arguments.#15610

Merged
serhiy-storchaka merged 3 commits into
python:masterfrom
serhiy-storchaka:bool-cleanup
Sep 1, 2019
Merged

bpo-15999: Clean up of handling boolean arguments.#15610
serhiy-storchaka merged 3 commits into
python:masterfrom
serhiy-storchaka:bool-cleanup

Conversation

serhiy-storchaka commented Aug 30, 2019
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member
  • Use the 'p' format unit instead of manually called PyObject_IsTrue().
  • Pass boolean value instead 0/1 integers to functions that needs boolean.
  • Convert some arguments to boolean only once.

https://bugs.python.org/issue15999

* Use the 'p' format unit instead of manually called PyObject_IsTrue(). * Pass boolean value instead 0/1 integers to functions that needs boolean. * Convert some arguments to boolean only once.
Comment thread Lib/codeop.py

def __call__(self, source, filename, symbol):
codeob = compile(source, filename, symbol, self.flags, 1)
codeob = compile(source, filename, symbol, self.flags, True)

sir-sigurd Aug 30, 2019
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

I'm not sure that's OK.

https://docs.python.org/3.9/library/functions.html#compile

The argument optimize specifies the optimization level of the compiler; the default value of -1 selects the optimization level of the interpreter as given by -O options. Explicit levels are 0 (no optimization; debug is true), 1 (asserts are removed, debug is false) or 2 (docstrings are removed too).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

It is dont_inherit, not optimize.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Oops, sorry.

serhiy-storchaka merged commit 1f21eaa into python:master Sep 1, 2019
serhiy-storchaka deleted the bool-cleanup branch September 1, 2019 09:16
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
* Use the 'p' format unit instead of manually called PyObject_IsTrue(). * Pass boolean value instead 0/1 integers to functions that needs boolean. * Convert some arguments to boolean only once.
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
* Use the 'p' format unit instead of manually called PyObject_IsTrue(). * Pass boolean value instead 0/1 integers to functions that needs boolean. * Convert some arguments to boolean only once.
websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
* Use the 'p' format unit instead of manually called PyObject_IsTrue(). * Pass boolean value instead 0/1 integers to functions that needs boolean. * Convert some arguments to boolean only once.
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.

4 participants

Footer

© 2026 GitHub, Inc.