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

Assignment to __builtins__.__debug__ doesn't do anything. #39717

Closed
jemfinch mannequin opened this issue Dec 18, 2003 · 3 comments
Closed

Assignment to __builtins__.__debug__ doesn't do anything. #39717

jemfinch mannequin opened this issue Dec 18, 2003 · 3 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@jemfinch
Copy link
Mannequin

jemfinch mannequin commented Dec 18, 2003

BPO 862600
Nosy @tim-one, @rhettinger

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/rhettinger'
closed_at = <Date 2004-01-16.04:08:38.000>
created_at = <Date 2003-12-18.23:55:52.000>
labels = ['interpreter-core']
title = "Assignment to __builtins__.__debug__ doesn't do anything."
updated_at = <Date 2004-01-16.04:08:38.000>
user = 'https://bugs.python.org/jemfinch'

bugs.python.org fields:

activity = <Date 2004-01-16.04:08:38.000>
actor = 'tim.peters'
assignee = 'rhettinger'
closed = True
closed_date = None
closer = None
components = ['Interpreter Core']
creation = <Date 2003-12-18.23:55:52.000>
creator = 'jemfinch'
dependencies = []
files = []
hgrepos = []
issue_num = 862600
keywords = []
message_count = 3.0
messages = ['19440', '19441', '19442']
nosy_count = 3.0
nosy_names = ['tim.peters', 'rhettinger', 'jemfinch']
pr_nums = []
priority = 'normal'
resolution = 'wont fix'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue862600'
versions = ['Python 2.3']

@jemfinch
Copy link
Mannequin Author

jemfinch mannequin commented Dec 18, 2003

In 2.2, it would dynamically turn off asserts: 
 
Python 2.2.3+ (#1, Sep 30 2003, 01:19:08) 
[GCC 3.3.2 20030908 (Debian prerelease)] on linux2 
Type "help", "copyright", "credits" or "license" for more 
information. 
>>> __debug__ 
1 
>>> __builtins__.__debug__ = 0 
>>> assert 0, "There should be nothing raised." 
>>> 
 
But in 2.3, this changed: 
 
Python 2.3.2 (#2, Nov 11 2003, 00:22:57) 
[GCC 3.3.2 (Debian)] on linux2 
Type "help", "copyright", "credits" or "license" for more 
information. 
>>> __debug__ 
True 
>>> __builtins__debug__ = False 
>>> assert 0, "There should be nothing raised." 
Traceback (most recent call last): 
  File "<stdin>", line 1, in ? 
AssertionError: There should be nothing raised. 
>>> 
 
If this is in fact the intended behavior (I hope it's not) then 
what's an application author to do when he wants to offer 
users a -O option *to his application* that turns off asserts?

@jemfinch jemfinch mannequin closed this as completed Dec 18, 2003
@jemfinch jemfinch mannequin assigned rhettinger Dec 18, 2003
@jemfinch jemfinch mannequin added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Dec 18, 2003
@jemfinch jemfinch mannequin closed this as completed Dec 18, 2003
@jemfinch jemfinch mannequin assigned rhettinger Dec 18, 2003
@jemfinch jemfinch mannequin added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Dec 18, 2003
@jemfinch
Copy link
Mannequin Author

jemfinch mannequin commented Jan 16, 2004

Logged In: YES
user_id=99508

Is this something that's likely to get fixed, or is it
something that I should start developing a workaround for?

@tim-one
Copy link
Member

tim-one commented Jan 16, 2004

Logged In: YES
user_id=31435

The NEWS file in your Python distribution, under the notes for
2.3 alpha 1, says:

"""

  • The assert statement no longer tests __debug__ at
    runtime. This means that assert statements cannot be
    disabled by assigning a false value to __debug__.
    """

Do a Google search on

site:mail.python.org python-dev assert __debug__

if you want to read a lot more about it. The decision on
Guido's part was certainly intentional. If people had griped
during the extremely long alpha/beta/release_candidate 2.3
cycle, he might have backed off -- but nobody did, so you're
best off to consider this one a dead issue.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)
Projects
None yet
Development

No branches or pull requests

2 participants