[issue43723] Deprecate camelCase aliases from threading.py

2021-04-15 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests: +24165
pull_request: https://github.com/python/cpython/pull/25435

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43860] unittest increment tests executed

2021-04-15 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

ISTM the call count is too indirect to provide a useful indicator of coverage.

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43817] Add typing.get_annotations()

2021-04-15 Thread Barry A. Warsaw


Change by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43723] Deprecate camelCase aliases from threading.py

2021-04-15 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 7.0 -> 8.0
pull_requests: +24164
pull_request: https://github.com/python/cpython/pull/25433

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43723] Deprecate camelCase aliases from threading.py

2021-04-15 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 56c76df6e861322bdff77bfb21e5cd55fbacfad2 by Terry Jan Reedy in 
branch '3.9':
[3.9] bpo-43723: Revert IDLE doc change (GH-25174)
https://github.com/python/cpython/commit/56c76df6e861322bdff77bfb21e5cd55fbacfad2


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43723] Deprecate camelCase aliases from threading.py

2021-04-15 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +terry.reedy
nosy_count: 6.0 -> 7.0
pull_requests: +24163
pull_request: https://github.com/python/cpython/pull/25432

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43860] unittest increment tests executed

2021-04-15 Thread Steve Kelem


New submission from Steve Kelem :

The unittest module (and most other unittest modules) keep a count of the 
number of functional tests run, as defined by the number of times test is 
called.

I would like the option to count the number of times that assert is called.

I have to run many tests (in unittest's sense of the word), but each of the 
tests consists of iterating through an array of hundreds or thousands of 
individual test cases with their expected results. These check for corner 
cases, interior, exterior cases, and for mathematical accuracy. It doesn't make 
sense to make a separate test case for each test value, when iterating through 
an array of values, and calling AssertEquals (or whatever is called for) for 
each expected & actual value-pair.
Yes, the existing methodology tells me that a particular functional test works, 
but it is important to know whether it passed based on a single test value 
(because the test development is not done or the tester was lazy) or whether it 
passed thousands of tests and will give adequate coverage. (Yes that can be 
cheated too, but assume that the tests are developed in earnest.)

--
components: Tests
messages: 391166
nosy: chelmite
priority: normal
severity: normal
status: open
title: unittest increment tests executed
type: enhancement
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41323] Perform "peephole" optimization directly on control-flow graph.

2021-04-15 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 8a232c7b17a2e41ae14d8bb7937ddfea69301dce by Inada Naoki in branch 
'master':
bpo-41323: compiler: Reuse tuple in constant tuple folding (GH-25419)
https://github.com/python/cpython/commit/8a232c7b17a2e41ae14d8bb7937ddfea69301dce


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37596] Reproducible pyc: frozenset is not serialized in a deterministic order

2021-04-15 Thread Chih-Hsuan Yen


Change by Chih-Hsuan Yen :


--
nosy:  -yan12125

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42238] Deprecate suspicious.py?

2021-04-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I agree with all you said, but I am against forcing the release management team 
to absorb the responsibility of fixing all the errors that the CI didn't catch, 
real or not. Releasing is already a multi-hour process and having many docs 
errors and formating mistakes to fix is a toll that should be paid at release 
time.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42238] Deprecate suspicious.py?

2021-04-15 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

If reactivated, the tool needs to be substantially improved.  It is NOT smart.  
The false positives for slicing and logging examples are unnecessarily 
annoying.  It creates a barrier for people submitting documentation patches.  
Each of the 367 entries in the susp-ignored file represents wasted time for 
contributors.

Also the CSV format is arcane, hard-to-read, and hard-to-edit.  It looks like 
it was quickly thrown together by someone who didn't care about usability.  
Perhaps there should be a simpler tools that says, "take this current failure 
and mark it as a false positive" without trying to be over specific.

Mandatory checks with a high false positive rate are an anti-pattern for CI 
systems.  Already we've had one case of a contributor (me) who abandoned a doc 
patch rather than fight this tooling.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43627] What are the requirements for a test_sundry-testable script in Tools/scripts?

2021-04-15 Thread Zachary Ware


Zachary Ware  added the comment:

`test_sundry` just checks to see if the script is importable, so if your script 
runs on import it may very well cause problems :).  Adding it to a skip list is 
a reasonable solution, as is making the script import-friendly (e.g. with a `if 
__name__ == '__main__'` check).

--
nosy: +zach.ware

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43782] Failure to build from source on ppc64le on ubuntu xenial

2021-04-15 Thread Anthony Sottile


Anthony Sottile  added the comment:

a rebuild succeeded so I'm ok closing this :shrug:

--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43782] Failure to build from source on ppc64le on ubuntu xenial

2021-04-15 Thread Zachary Ware


Change by Zachary Ware :


--
resolution:  -> third party
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39376] Avoid modifying the process global environment (not thread safe)

2021-04-15 Thread STINNER Victor


Change by STINNER Victor :


--
components: +Subinterpreters

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43859] Improve syntax error for indentation errors

2021-04-15 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +24162
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25431

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43859] Improve syntax error for indentation errors

2021-04-15 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

The current indentation error is quite simplistic and it does not include the 
context of the statement that was associated with the indented block and where 
it was:

>>> def foo():
... if lel:
... x = 2
  File "", line 3
x = 2
^
IndentationError: expected an indented block

we can improve the error by adding some context:

>>> def foo():
...if lel:
...x = 2
  File "", line 3
x = 2
^
IndentationError: expected an indented block after if statement in line 2

--
messages: 391160
nosy: ammar2, pablogsal
priority: normal
severity: normal
status: open
title: Improve syntax error for indentation errors

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37596] Reproducible pyc: frozenset is not serialized in a deterministic order

2021-04-15 Thread Filipe Laíns

Filipe Laíns  added the comment:

s/is can/can/

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37596] Reproducible pyc: frozenset is not serialized in a deterministic order

2021-04-15 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

s/hundred/hundred thousand/

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37596] Reproducible pyc: frozenset is not serialized in a deterministic order

2021-04-15 Thread Filipe Laíns

Filipe Laíns  added the comment:

> No, it would not.  We would also have to maintain order across set operations 
> such as intersection which which would become dramatically more expensive if 
> they had to maintain order.  For example intersecting a million element set 
> with a ten element set always takes ten steps regardless of the order of 
> arguments, but to maintain order of the left hand operand could take a 
> hundred times more work.

Can these operations happen during bytecode generation? I am fairly new to 
these internals so my understanding is not great. During bytecode generation is 
can code that performs such operations run?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40443] Remove unused imports in the stdlib (April 2020 edition)

2021-04-15 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +24161
pull_request: https://github.com/python/cpython/pull/25429

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37596] Reproducible pyc: frozenset is not serialized in a deterministic order

2021-04-15 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Would it be reasonable to make it so that sets are 
> always created with the definition order?

No, it would not.  We would also have to maintain order across set operations 
such as intersection which which would become dramatically more expensive if 
they had to maintain order.  For example intersecting a million element set 
with a ten element set always takes ten steps regardless of the order of 
arguments, but to maintain order of the left hand operand could take a hundred 
times more work.

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43823] Improve syntax errors for invalid dictionary literals

2021-04-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset b5b98bd8f8c72a9068cf149dbc162c8c95d30057 by Pablo Galindo in 
branch 'master':
bpo-43823: Fix location of one of the errors for invalid dictionary literals 
(GH-25427)
https://github.com/python/cpython/commit/b5b98bd8f8c72a9068cf149dbc162c8c95d30057


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43809] Improve mismatching parentheses error

2021-04-15 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43809] Improve mismatching parentheses error

2021-04-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

This is probably not worth the complexity, so I am closing it

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43823] Improve syntax errors for invalid dictionary literals

2021-04-15 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +24160
pull_request: https://github.com/python/cpython/pull/25427

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38671] pathlib.Path.resolve(strict=False) returns relative path on Windows if the entry does not exist

2021-04-15 Thread Claudio Jolowicz


Change by Claudio Jolowicz :


--
nosy: +cjolowicz

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43822] Improve syntax errors for missing commas

2021-04-15 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43856] Docs for importlib.metadata should mention Python version

2021-04-15 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
assignee:  -> jaraco

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42037] Documentation confusion in CookieJar functions

2021-04-15 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I can confirm `unverifiable` is an attr: 
https://github.com/python/cpython/blob/master/Lib/urllib/request.py#L333

and so is incorrectly listed as a method in cookie jar docs.

--
nosy: +andrei.avk

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43822] Improve syntax errors for missing commas

2021-04-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset b280248be8e648feb82f3f3ed0050e50b238df7b by Pablo Galindo in 
branch 'master':
bpo-43822: Improve syntax errors for missing commas (GH-25377)
https://github.com/python/cpython/commit/b280248be8e648feb82f3f3ed0050e50b238df7b


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43854] curses: returns incorrect chars after resuming a suspended process

2021-04-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Python method is just a thin wrapper around corresponding curses function 
(wgetch() in this case). It looks like an issue is in the curses library. We 
cannot do anything with it.

--
nosy: +serhiy.storchaka
resolution:  -> third party
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43846] Control stack usage in large expressions

2021-04-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What is performance impact of this change? I expect that creating a list 
incrementally can hurt performance, but how much?

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43852] [sqlite3] Improve tuple creation

2021-04-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I considered rewriting this code when touched that files last time (in 
issue43083). But PyTuple_SetItem() newer fails in these cases, so I left it as 
is to minimize change.

So it is a pure cosmetic change. I am not opposing it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43646] ForwardRef name conflict during evaluation

2021-04-15 Thread Christodoulos Tsoulloftas


Christodoulos Tsoulloftas  added the comment:

@kj I can confirm the issue is resolved with Python 3.10.0a7+

--
status: pending -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43858] Provide method to get list of logging level names

2021-04-15 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +vinay.sajip

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43858] Provide method to get list of logging level names

2021-04-15 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43858] Provide method to get list of logging level names

2021-04-15 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

I agree with you. It would be nice to have a function to list or dictionary of 
level names. Moreover I suggest that there should be an argument to the 
function like format_level which can take in "dict:level_name" for returning a 
dictionary with the level as keys and name as values, "dict:name_level" for 
returning a dictionary with the name as keys and level as values or "list" for 
returning just the list of level names ordered by priority.

--
nosy: +shreyanavigyan

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41100] Support macOS 11 and Apple Silicon Macs

2021-04-15 Thread Ned Deily


Ned Deily  added the comment:

No problem. Also you should not need to specify sysroot if you are; the Apple 
compiler front-end takes care of that for you (see man xcrun for more details).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43858] Provide method to get list of logging level names

2021-04-15 Thread Andy Lowry


New submission from Andy Lowry :

It would be useful to have something like a `getLevelNames` method to return 
the current list of level names, ordered by priority.

This currently appears to be available only by accessing a private member, like 
`_levelToName` or `_nameToLevel`.

This functionality is useful, for example, in populating a `choices` list for 
an `argparse` option to allow a user to select a logging level when launching a 
program from a command line.

--
components: Library (Lib)
messages: 391145
nosy: andylowry
priority: normal
severity: normal
status: open
title: Provide method to get list of logging level names
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43804] Add more info about building C/C++ Extensions on Windows using MSVC

2021-04-15 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Please have a review.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43856] Docs for importlib.metadata should mention Python version

2021-04-15 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

importlib.metadata was introduced in Python 3.8. But you're right the docs 
should mention about the version importlib.metadata was introduced in.

--
nosy: +shreyanavigyan

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41100] Support macOS 11 and Apple Silicon Macs

2021-04-15 Thread Harlan Cheer


Harlan Cheer  added the comment:

@ned.deily sorry about that, will do that in the future. Thanks for replying.

in regard to the extra args, those were all added in an attempt to make things 
work, I should probably have shown an earlier log that excluded them. I wasn't 
sure setup.py would be the right place to look for more, I'll take a look there.

Thanks

--
type:  -> compile error

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41100] Support macOS 11 and Apple Silicon Macs

2021-04-15 Thread Ned Deily


Ned Deily  added the comment:

@harlantc, in general, please open new issues for new problems. That said, I 
took a quick look at the build.log you provided and it was not obvious exactly 
why things went wrong. The most obvious difference is that when I do a 3.9.4 
build, the extension module source paths (the -c arguments to the failing 
compiles) have been normalized by setup.py to absolute paths, whereas in the 
failing build.log they are unprefixed relative paths. I suggest you look at the 
top level setup.py file to figure out why that is the case in your build. I 
also note that the build appears to be on a very early release of macOS 11 Big 
Sur; it would be best to upgrade to the latest version of it and ensure you 
have the latest version of the Command Line Tools installed. Also, your 
configure arguments appear to be unnecessary complex: the -m64 and the --build 
and --target arguments shouldn't be necessary and we rarely test with 
--enable-shared on macOS. It's possible they are contributing factors.  If you 
do 
 find something that appears to be a Python build issue, please open a new 
issue with the details.

--
type: compile error -> 

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40222] "Zero cost" exception handling

2021-04-15 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy: +gvanrossum

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34321] mmap.mmap() should not necessarily clone the file descriptor

2021-04-15 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 3.0 -> 4.0
pull_requests: +24159
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25425

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43857] Fix the AttributeError message for deletion of a missing attribute

2021-04-15 Thread Géry

Change by Géry :


--
keywords: +patch
pull_requests: +24158
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25424

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43857] Fix the AttributeError message for deletion of a missing attribute

2021-04-15 Thread Géry

New submission from Géry :

Compare the `AttributeError` messages in this interactive Python session:

```python
>>> class A:
... y = 0
... __slots__ = ('z',)
... 
>>> A().x
[…]
AttributeError: 'A' object has no attribute 'x'
>>> A().x = 1
[…]
AttributeError: 'A' object has no attribute 'x'
>>> del A().x
[…]
AttributeError: 'A' object has no attribute 'x'
>>> A().y
0
>>> A().y = 2
[…]
AttributeError: 'A' object attribute 'y' is read-only
>>> del A().y
[…]
AttributeError: 'A' object attribute 'y' is read-only
>>> A().z
[…]
AttributeError: z
>>> A().z = 3
>>> del A().z
[…]
AttributeError: z
```

with the `AttributeError` messages in that one:

```python
>>> class B: pass
... 
>>> B().x
[…]
AttributeError: 'B' object has no attribute 'x'
>>> B().x = 1
>>> del B().x
[…]
AttributeError: x
```

The message `AttributeError: x` from `del B().x` does not feel right. I expect 
this message to be the same as the message `AttributeError: 'B' object has no 
attribute 'x'` from `B().x`, since in both cases the object `B()` has no 
attribute `'x'`.

I have checked on PyPy 7.3.3 (Python 3.7.9) and it uses the expected message 
`AttributeError: 'B' object has no attribute 'x'` from `B().x` for `del B().x`. 
So this confirms my initial suspicion.



In CPython, the `AttributeError` message for attribute retrieval is implemented 
[here](https://github.com/python/cpython/blob/v3.9.4/Objects/object.c#L1266-L1270)
 (except for [slot 
retrieval](https://github.com/python/cpython/blob/v3.9.4/Python/structmember.c#L70-L75)):

```c
if (!suppress) {
PyErr_Format(PyExc_AttributeError,
 "'%.50s' object has no attribute '%U'",
 tp->tp_name, name);
}
```

And the `AttributeError` messages for attribute assignment and deletion are 
implemented 
[here](https://github.com/python/cpython/blob/v3.9.4/Objects/object.c#L1324-L1350)
 (except for [slot 
deletion](https://github.com/python/cpython/blob/v3.9.4/Python/structmember.c#L112-L118)):

```c
if (dict == NULL) {
dictptr = _PyObject_GetDictPtr(obj);
if (dictptr == NULL) {
if (descr == NULL) {
PyErr_Format(PyExc_AttributeError,
 "'%.100s' object has no attribute '%U'",
 tp->tp_name, name);
}
else {
PyErr_Format(PyExc_AttributeError,
 "'%.50s' object attribute '%U' is read-only",
 tp->tp_name, name);
}
goto done;
}
res = _PyObjectDict_SetItem(tp, dictptr, name, value);
}
else {
Py_INCREF(dict);
if (value == NULL)
res = PyDict_DelItem(dict, name);
else
res = PyDict_SetItem(dict, name, value);
Py_DECREF(dict);
}
if (res < 0 && PyErr_ExceptionMatches(PyExc_KeyError))
PyErr_SetObject(PyExc_AttributeError, name);
```

So it is the last line `PyErr_SetObject(PyExc_AttributeError, name);` that 
would be updated. Note that `_PyObjectDict_SetItem` delegates to 
`PyDict_DelItem` (if `value` is `NULL`) or `PyDict_SetItem` (if `value` is not 
`NULL`), and that only `PyDict_DelItem` can [set an 
exception](https://github.com/python/cpython/blob/v3.9.4/Objects/dictobject.c#L1655-L1657)
 `PyExc_KeyError`, which is then translated to an exception 
`PyExc_AttributeError` in the last line.

--
components: Interpreter Core
messages: 391140
nosy: maggyero
priority: normal
severity: normal
status: open
title: Fix the AttributeError message for deletion of a missing attribute
type: enhancement
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43856] Docs for importlib.metadata should mention Python version

2021-04-15 Thread Antoine Pitrou


New submission from Antoine Pitrou :

https://docs.python.org/3/library/importlib.metadata.html lacks a mention of 
which Python version saw the introduction of `importlib.metadata` (it 
definitely doesn't exist in my 3.7 install, for example).

--
components: Library (Lib)
messages: 391139
nosy: eric.araujo, ezio.melotti, jaraco, mdk, pitrou, willingc
priority: normal
severity: normal
stage: needs patch
status: open
title: Docs for importlib.metadata should mention Python version
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41100] Support macOS 11 and Apple Silicon Macs

2021-04-15 Thread Harlan Cheer


Harlan Cheer  added the comment:

Trying to build from source to Apple M1 Big Sur (macOS 11), and it's failing to 
compile the standard library extension modules. It seems to be that the .c 
files are not being located properly, but looking in Modules/ I can see all the 
required source files are there. attached is a typical build log, have tried a 
variety of options to no avail. Similar build configurations have worked for 
previous MacOS releases, which leads me to believe this is something else. I've 
searched fairly exhaustively for any information related to this and come up 
with nothing.

--
nosy: +harlantc
type:  -> compile error
Added file: https://bugs.python.org/file49962/build.log

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43852] [sqlite3] Improve tuple creation

2021-04-15 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
title: [sqlite3] Harden tuple creation -> [sqlite3] Improve tuple creation

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42248] Raised exception in Enum keeping user objects alive unnecessarily

2021-04-15 Thread Ethan Furman


Change by Ethan Furman :


--
assignee:  -> ethan.furman
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type: enhancement -> behavior
versions: +Python 3.10, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43744] enum: Adding a member named _classname__ raises IndexError

2021-04-15 Thread Ethan Furman


Change by Ethan Furman :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43744] enum: Adding a member named _classname__ raises IndexError

2021-04-15 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset ec09973f5b21d33550c834ddc89606b0e1c70ffd by Ethan Furman in 
branch 'master':
bpo-43744: [Enum] fix ``_is_private`` (GH-25349)
https://github.com/python/cpython/commit/ec09973f5b21d33550c834ddc89606b0e1c70ffd


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40006] enum: Add documentation for _create_pseudo_member_ and composite members

2021-04-15 Thread Ethan Furman


Change by Ethan Furman :


--
assignee: docs@python -> ethan.furman
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10 -Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43846] Control stack usage in large expressions

2021-04-15 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 11e0b295dee235dd6fd66a10d4823b0dcb014dc4 by Mark Shannon in 
branch 'master':
bpo-43846: Use less stack for large literals and calls (GH-25403)
https://github.com/python/cpython/commit/11e0b295dee235dd6fd66a10d4823b0dcb014dc4


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43823] Improve syntax errors for invalid dictionary literals

2021-04-15 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43823] Improve syntax errors for invalid dictionary literals

2021-04-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset da7435017430671f86075449ff7bde96fd7700a5 by Pablo Galindo in 
branch 'master':
bpo-43823: Improve syntax errors for invalid dictionary literals (GH-25378)
https://github.com/python/cpython/commit/da7435017430671f86075449ff7bde96fd7700a5


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41682] [Windows] test_asyncio: Proactor test_sendfile_close_peer_in_the_middle_of_receiving failure

2021-04-15 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41682] [Windows] test_asyncio: Proactor test_sendfile_close_peer_in_the_middle_of_receiving failure

2021-04-15 Thread STINNER Victor


Change by STINNER Victor :


--
title: test_asyncio: Proactor 
test_sendfile_close_peer_in_the_middle_of_receiving failure -> [Windows] 
test_asyncio: Proactor test_sendfile_close_peer_in_the_middle_of_receiving 
failure

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41682] test_asyncio: Proactor test_sendfile_close_peer_in_the_middle_of_receiving failure

2021-04-15 Thread STINNER Victor


STINNER Victor  added the comment:

I marked bpo-42124 and bpo-43539 as a duplicate of this issue.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43539] test_asyncio: test_sendfile_close_peer_in_the_middle_of_receiving() fails randomly

2021-04-15 Thread STINNER Victor


STINNER Victor  added the comment:

Duplicate of bpo-41682.

--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> test_asyncio: Proactor 
test_sendfile_close_peer_in_the_middle_of_receiving failure

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42124] FAIL test_asyncio test_sendfile_close_peer_in_the_middle_of_receiving

2021-04-15 Thread STINNER Victor


STINNER Victor  added the comment:

Duplicate of bpo-41682.

--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> test_asyncio: Proactor 
test_sendfile_close_peer_in_the_middle_of_receiving failure

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41682] test_asyncio: Proactor test_sendfile_close_peer_in_the_middle_of_receiving failure

2021-04-15 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
nosy: +vstinner
nosy_count: 3.0 -> 4.0
pull_requests: +24157
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25400

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43539] test_asyncio: test_sendfile_close_peer_in_the_middle_of_receiving() fails randomly

2021-04-15 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +24155
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25400

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42124] FAIL test_asyncio test_sendfile_close_peer_in_the_middle_of_receiving

2021-04-15 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
nosy: +vstinner
nosy_count: 3.0 -> 4.0
pull_requests: +24156
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/25400

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43855] test_ssl: test_msg_callback_deadlock_bpo43577() failed on macOS of GitHub Action

2021-04-15 Thread STINNER Victor


New submission from STINNER Victor :

macOS of GitHub Action failed:
https://github.com/python/cpython/pull/25400/checks?check_run_id=2344085246

ERROR: test_msg_callback_deadlock_bpo43577 (test.test_ssl.TestSSLDebug)
--
Traceback (most recent call last):
  File "/Users/runner/work/cpython/cpython/Lib/test/test_ssl.py", line 4799, in 
test_msg_callback_deadlock_bpo43577
s.connect((HOST, server.port))
  File "/Users/runner/work/cpython/cpython/Lib/ssl.py", line 1342, in connect
self._real_connect(addr, False)
  File "/Users/runner/work/cpython/cpython/Lib/ssl.py", line 1329, in 
_real_connect
super().connect(addr)
ConnectionRefusedError: [Errno 61] Connection refused


Test code:

def test_msg_callback_deadlock_bpo43577(self):
client_context, server_context, hostname = testing_context()
server_context2 = testing_context()[1]

def msg_cb(conn, direction, version, content_type, msg_type, data):
pass

def sni_cb(sock, servername, ctx):
sock.context = server_context2

server_context._msg_callback = msg_cb
server_context.sni_callback = sni_cb

server = ThreadedEchoServer(context=server_context, chatty=False)
with server:
with client_context.wrap_socket(socket.socket(),
server_hostname=hostname) as s:
s.connect((HOST, server.port))
with client_context.wrap_socket(socket.socket(),
server_hostname=hostname) as s:
s.connect((HOST, server.port))  # <= FAIL HERE 


test.pythoninfo:

ssl.HAS_SNI: True
ssl.OPENSSL_VERSION: OpenSSL 1.1.1k  25 Mar 2021
ssl.OPENSSL_VERSION_INFO: (1, 1, 1, 11, 15)
ssl.OP_ALL: 0x8054
ssl.OP_NO_TLSv1_1: 0x1000
ssl.SSLContext.maximum_version: MAXIMUM_SUPPORTED
ssl.SSLContext.minimum_version: MINIMUM_SUPPORTED
ssl.SSLContext.options: 
OP_NO_COMPRESSION|OP_ENABLE_MIDDLEBOX_COMPAT|OP_CIPHER_SERVER_PREFERENCE|OP_NO_SSLv3|0x8054
ssl.SSLContext.protocol: PROTOCOL_TLS
ssl.SSLContext.verify_mode: CERT_NONE
ssl.default_https_context.maximum_version: MAXIMUM_SUPPORTED
ssl.default_https_context.minimum_version: MINIMUM_SUPPORTED
ssl.default_https_context.options: 
OP_NO_COMPRESSION|OP_ENABLE_MIDDLEBOX_COMPAT|OP_CIPHER_SERVER_PREFERENCE|OP_NO_SSLv3|0x8054
ssl.default_https_context.protocol: PROTOCOL_TLS
ssl.default_https_context.verify_mode: CERT_REQUIRED
ssl.stdlib_context.maximum_version: MAXIMUM_SUPPORTED
ssl.stdlib_context.minimum_version: MINIMUM_SUPPORTED
ssl.stdlib_context.options: 
OP_NO_COMPRESSION|OP_ENABLE_MIDDLEBOX_COMPAT|OP_CIPHER_SERVER_PREFERENCE|OP_NO_SSLv3|0x8054
ssl.stdlib_context.protocol: PROTOCOL_TLS
ssl.stdlib_context.verify_mode: CERT_NONE


The test was added recently:

commit 77cde5042a2f1eae489c11a67540afaf43cd5cdf
Author: Christian Heimes 
Date:   Sun Mar 21 16:13:09 2021 +0100

bpo-43577: Fix deadlock with SSLContext._msg_callback and sni_callback 
(GH-24957)

OpenSSL copies the internal message callback from SSL_CTX->msg_callback to
SSL->msg_callback. SSL_set_SSL_CTX() does not update SSL->msg_callback
to use the callback value of the new context.

PySSL_set_context() now resets the callback and _PySSL_msg_callback()
resets thread state in error path.

Signed-off-by: Christian Heimes 

--
components: Tests
messages: 391131
nosy: christian.heimes, vstinner
priority: normal
severity: normal
status: open
title: test_ssl: test_msg_callback_deadlock_bpo43577() failed on macOS of 
GitHub Action
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35056] Test leaks of memory not managed by Python allocator

2021-04-15 Thread STINNER Victor


STINNER Victor  added the comment:

Multiple C library don't provide msize() function. If you seriously consider to 
add it, you should conduct a study on all platforms.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43852] [sqlite3] Harden tuple creation

2021-04-15 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

I've updated my PR to use PyTuple_Pack. Nice reduction in code size. Thanks, 
Mark!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43852] [sqlite3] Harden tuple creation

2021-04-15 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Yes, the _pysqlite_query_execute() case might be cleaner. But I was under the 
impression that using PyTuple_Pack() was significantly slower. Correct me if 
I'm wrong.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43852] [sqlite3] Harden tuple creation

2021-04-15 Thread Mark Dickinson


Mark Dickinson  added the comment:

Would the code be cleaner if it used PyTuple_Pack?

--
nosy: +mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43854] curses: returns incorrect chars after resuming a suspended process

2021-04-15 Thread darrikonn


New submission from darrikonn :

Using the arrow keys after resuming a suspended process yields `27 (escape)` 
from `getch`/`get_wch`/...

Steps to reproduce:

```
# test.py
from curses import wrapper

def main(stdscr):
# Clear screen
stdscr.clear()

key = 0
while key != 27:
key = stdscr.getch()
stdscr.addstr(0, 0, str(key))

stdscr.refresh()

wrapper(main)
```

1. python test.py
2. ctrl-z
3. fg
4. 

This gives the char `27` which is the escape character and therefore exits the 
python script.

--
components: Library (Lib)
messages: 391126
nosy: darrikonn
priority: normal
severity: normal
status: open
title: curses: returns incorrect chars after resuming a suspended process
type: behavior
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35056] Test leaks of memory not managed by Python allocator

2021-04-15 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Victor, Serhiy: Would this issue be "large" or important enough to re-raise the 
debate about implementing an msize() function in the PyMem_ API, or is it not 
worth it? I guess no; it has been discussed numerous times before. Else, I can 
start a thread on Discourse.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43853] [sqlite3] Fix sqlite3_value_text() usage

2021-04-15 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
title: [sqlite] Fix sqlite3_value_text() usage -> [sqlite3] Fix 
sqlite3_value_text() usage

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43853] [sqlite] Fix sqlite3_value_text() usage

2021-04-15 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +24154
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25422

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43853] [sqlite] Fix sqlite3_value_text() usage

2021-04-15 Thread Erlend Egeberg Aasland


New submission from Erlend Egeberg Aasland :

Fix sqlite3_value_text() usage:
- Raise MemoryError if sqlite3_value_text() sets SQLITE_NOMEM
- Let PyUnicode_FromStringAndSize() errors propagate

Quoting the SQLite docs:
"As long as the input parameter is correct, these routines can only fail if an 
out-of-memory error occurs"


See also:
- bpo-43296
- https://sqlite.org/c3ref/value_blob.html

--
components: Extension Modules
files: patch.diff
keywords: patch
messages: 391124
nosy: berker.peksag, erlendaasland, serhiy.storchaka
priority: normal
severity: normal
status: open
title: [sqlite] Fix sqlite3_value_text() usage
type: behavior
versions: Python 3.10
Added file: https://bugs.python.org/file49961/patch.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38530] Offer suggestions on AttributeError and NameError

2021-04-15 Thread STINNER Victor


STINNER Victor  added the comment:

I like the https://docs.python.org/dev/whatsnew/3.10.html#better-error-messages 
section: well done, thanks ;-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38634] Symbol resolution conflict when embeding python in an application using libedit

2021-04-15 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43852] [sqlite3] Harden tuple creation

2021-04-15 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +24153
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25421

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43852] [sqlite3] Harden tuple creation

2021-04-15 Thread Erlend Egeberg Aasland


New submission from Erlend Egeberg Aasland :

All but one of the PyTuple_SetItem() calls are executed without checking the 
return value.

Callers:
$ grep -r PyTuple_SetItem Modules/_sqlite 
Modules/_sqlite/connection.c:PyTuple_SetItem(args, i, cur_py_value);
Modules/_sqlite/cursor.c:PyTuple_SetItem(row, i, converted);
Modules/_sqlite/cursor.c:if (PyTuple_SetItem(func_args, 0, 
Py_NewRef(operation)) != 0) {
Modules/_sqlite/cursor.c:PyTuple_SetItem(descriptor, 0, 
column_name);
Modules/_sqlite/cursor.c:PyTuple_SetItem(descriptor, 1, 
Py_NewRef(Py_None));
Modules/_sqlite/cursor.c:PyTuple_SetItem(descriptor, 2, 
Py_NewRef(Py_None));
Modules/_sqlite/cursor.c:PyTuple_SetItem(descriptor, 3, 
Py_NewRef(Py_None));
Modules/_sqlite/cursor.c:PyTuple_SetItem(descriptor, 4, 
Py_NewRef(Py_None));
Modules/_sqlite/cursor.c:PyTuple_SetItem(descriptor, 5, 
Py_NewRef(Py_None));
Modules/_sqlite/cursor.c:PyTuple_SetItem(descriptor, 6, 
Py_NewRef(Py_None));
Modules/_sqlite/cursor.c:PyTuple_SetItem(self->description, i, 
descriptor);


All of these are operating on newly created tuples, so I suggest replacing them 
with PyTuple_SET_ITEM() instead of adding error handling.


For the users in _pysqlite_query_execute() I also suggest to move the tuple 
creation closer to the code that fills it, in order to minimise the number of 
decref's needed in case of error.

--
components: Extension Modules
files: patch.diff
keywords: patch
messages: 391122
nosy: berker.peksag, erlendaasland, serhiy.storchaka
priority: normal
severity: normal
status: open
title: [sqlite3] Harden tuple creation
type: behavior
versions: Python 3.10
Added file: https://bugs.python.org/file49960/patch.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43252] deepcopy of weakref proxies

2021-04-15 Thread Konrad Schwarz


Konrad Schwarz  added the comment:

Well, in the example code, the memo dictionary contains the (hard) reference to 
newly created objects but ultimately, at the close of the deepcopy, the objects 
are (hard) referenced using the normal "child" attributes.

I don't however know how this would work if this was implemented within the 
weakref code but I expect that their __deepcopy__ method also has access to the 
memo variable.  If, at the close of deepcopy and the destruction of memo, no 
(hard) references exist to an object, then it would be collected, but that 
matches standard weak reference semantics.

Even if it were not possible to solve this programmatically within Python, I 
think the problem (and e.g. the workaround given below) should be mentioned in 
the documentation of deepcopy and/or weakref.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43498] "dictionary changed size during iteration" error in _ExecutorManagerThread

2021-04-15 Thread Jakub Kulik


Jakub Kulik  added the comment:

I investigated a little bit more and found out that this happens when 
`ProcessPoolExecutor::_adjust_process_count()` adds a new process during the 
iteration.

With the following change, I can reproduce this reliably every time:

--- Python-3.9.1/Lib/concurrent/futures/process.py
+++ Python-3.9.1/Lib/concurrent/futures/process.py
@@ -373,7 +373,14 @@ class _ExecutorManagerThread(threading.T
 assert not self.thread_wakeup._closed
 wakeup_reader = self.thread_wakeup._reader
 readers = [result_reader, wakeup_reader]
-worker_sentinels = [p.sentinel for p in self.processes.values()]
+worker_sentinels = []
+for p in self.processes.values():
+time.sleep(1)
+worker_sentinels.append(p.sentinel)
 ready = mp.connection.wait(readers + worker_sentinels)
 
 cause = None

Since `wait_result_broken_or_wakeup()` is called periodically, and there is no 
issue if processes added during the iteration are omitted (if they were added 
just after that, they would be omitted anyway), the attached PR shouldn't break 
anything.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43847] [Windows] ntpath.realpath() of bytes root directory may raise TypeError in some cases

2021-04-15 Thread Eryk Sun


Eryk Sun  added the comment:

In ntpath._getfinalpathname_nonstrict(), `tail` should be initialized to 
`path[:0]`. 

Currently `tail` is initialized to the empty string value ''. If an error 
occurs that's allowed and `path` is a root directory that's passed as bytes, 
then joining `path + tail` will fail if `tail` still has its initial value. 

To reproduce this issue, create a substitute drive for a directory that grants 
no access. For example:

import os
os.mkdir('spam')
os.system('icacls spam /inheritance:r')
os.system('subst N: spam')

>>> os.path.realpath(b'N:/')
Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\ntpath.py", line 647, in realpath
path = _getfinalpathname(path)
PermissionError: [WinError 5] Access is denied: b'N:\\'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\ntpath.py", line 601, in 
_getfinalpathname_nonstrict
path = _getfinalpathname(path)
PermissionError: [WinError 5] Access is denied: b'N:\\'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Program Files\Python39\lib\ntpath.py", line 651, in realpath
path = _getfinalpathname_nonstrict(path)
  File "C:\Program Files\Python39\lib\ntpath.py", line 621, in 
_getfinalpathname_nonstrict
return path + tail
TypeError: can't concat str to bytes

--
components: +Library (Lib)
nosy: +Antoine d'Otreppe, eryksun -9001
stage:  -> needs patch
title: realpath of bytestr smb drive letters fail -> [Windows] 
ntpath.realpath() of bytes root directory may raise TypeError in some cases
versions: +Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com