[issue41883] ctypes pointee goes out of scope, then pointer in struct dangles and crashes

2020-09-28 Thread Eryk Sun


Eryk Sun  added the comment:

I think this is a numpy issue. Its data_as() method doesn't support the ctypes 
_objects protocol to keep the numpy array referenced by subsequently created 
ctypes objects. For example:

import ctypes
import numpy as np

dtype = ctypes.c_double
ptype = ctypes.POINTER(dtype)

class array_struct(ctypes.Structure):
_fields_ = (('dim1', ctypes.c_int),
('dim2', ctypes.c_int),
('ptr', ptype))

n = 12
m = 50
a = np.ones((n, m), dtype=dtype)
p = a.ctypes.data_as(ptype)

data_as() is implemented as a cast() of the ctypes._data pointer. This is a 
c_void_p instance for the base address of the numpy array, but it doesn't 
reference the numpy array object itself. The pointer returned by cast() 
references this _data pointer in its _objects:

>>> p._objects
{139993690976448: c_void_p(42270224)}

data_as() also sets a reference to the numpy array object as a non-ctypes _arr 
attribute:

>>> p._arr is a
True

This _arr attribute keeps the array referenced for the particular instance, but 
ctypes isn't aware of it. When the object returned by data_as() is set in a 
struct, ctypes only carries forward the c_void_p reference from _objects that 
it's aware of:

>>> a_wrap1 = array_struct(n, m, p)
>>> a_wrap1._objects
{'2': {139993690976448: c_void_p(42270224)}}

It would be sufficient to keep the numpy array alive if this c_void_p instance 
referenced the array, but it doesn't. Alternatively, data_as() could update the 
_objects dict to reference the array. For example:

>>> p._objects['1'] = a
>>> a_wrap2 = array_struct(n, m, p)
>>> a_wrap2._objects['2']['1'] is a
True

--
nosy: +eryksun

___
Python tracker 

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



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-28 Thread miss-islington


miss-islington  added the comment:


New changeset 868c8e41eb1d7dc032679ae06e62c0d60edd7725 by Miss Islington (bot) 
in branch '3.9':
bpo-41774: Add programming FAQ entry (GH-22402)
https://github.com/python/cpython/commit/868c8e41eb1d7dc032679ae06e62c0d60edd7725


--

___
Python tracker 

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



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-28 Thread miss-islington


miss-islington  added the comment:


New changeset d50a0700265536a20bcce3fb108c954746d97625 by Miss Islington (bot) 
in branch '3.8':
bpo-41774: Add programming FAQ entry (GH-22402)
https://github.com/python/cpython/commit/d50a0700265536a20bcce3fb108c954746d97625


--

___
Python tracker 

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



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-28 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 6.0 -> 7.0
pull_requests: +21477
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/22447

___
Python tracker 

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



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +21478
pull_request: https://github.com/python/cpython/pull/22448

___
Python tracker 

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



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 5b0181d1f6474c2cb9b80bdaf3bc56a78bf5fbe7 by Terry Jan Reedy in 
branch 'master':
bpo-41774: Add programming FAQ entry (GH-22402)
https://github.com/python/cpython/commit/5b0181d1f6474c2cb9b80bdaf3bc56a78bf5fbe7


--

___
Python tracker 

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



[issue41878] python3 fails to use custom mapping object as symbols in eval()

2020-09-28 Thread Robert Haschke


Robert Haschke  added the comment:

Looks like the list generator is considered as a new nested scope, which 
prohibits access to local variables?
This basic expression, passing local symbols only, fails as well:

eval('[abc[i]*abc[i] for i in [0, 1, 2]]', {}, dict(abc=[1, 2, 3]))

while this one, passing dict as global symbols, works:

eval('[abc[i]*abc[i] for i in [0, 1, 2]]', dict(abc=[1, 2, 3]))

However, passing globals must be a real dict. So I cannot simply pass my custom 
mapping to globals.

--
title: python3 fails to use custom dict-like object as symbols in eval() -> 
python3 fails to use custom mapping object as symbols in eval()

___
Python tracker 

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



[issue41883] ctypes pointee goes out of scope, then pointer in struct dangles and crashes

2020-09-28 Thread Ian M. Hoffman


New submission from Ian M. Hoffman :

A description of the problem, complete example code for reproducing it, and a 
work-around are available on SO at the link:

https://stackoverflow.com/questions/64083376/python-memory-corruption-after-successful-return-from-a-ctypes-foreign-function

In summary: (1) create an array within a Python function, (2) create a 
ctypes.Structure with a pointer to that array, (3) return that struct from the 
Python function, (4) pass the struct out and back to a foreign function, (5) 
Python can successfully dereference the return from the foreign function, then 
(6) Python crashes.

As far as I can tell, when the array in the function goes out of scope at the 
end of the function, the pointer to it in the struct becomes dangling ... but 
the dangling doesn't catch up with Python until the very end when the Python 
struct finally goes out of scope in Python and the GC can't find its pointee.

I've reproduced this on Windows and linux with gcc- and MSVC-compiled Python 
3.6 and 3.8.

Perhaps it is not good practice on my part to have let the array go out of 
scope, but perhaps a warning from Python (or at least some internal awareness 
that the memory is no longer addressed) is in order so that Python doesn't 
crash upon failing to free it.

This may be related to #39217; I can't tell.

--
components: ctypes
messages: 377652
nosy: NankerPhelge
priority: normal
severity: normal
status: open
title: ctypes pointee goes out of scope, then pointer in struct dangles and 
crashes
type: crash
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue41879] Outdated description of async iterables in documentation of async for statement

2020-09-28 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
components: +asyncio
nosy: +asvetlov, yselivanov

___
Python tracker 

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



[issue41881] New Line escape issue in raw strings

2020-09-28 Thread Kevin Ardath


Change by Kevin Ardath :


--
resolution:  -> not a bug
stage:  -> 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



[issue41773] Clarify handling of infinity and nan in random.choices

2020-09-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the PR and for filing the issue.

--
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



[issue41773] Clarify handling of infinity and nan in random.choices

2020-09-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset b0dfc7581697f20385813582de7e92ba6ba0105f by Ram Rachum in branch 
'master':
bpo-41773: Raise exception for non-finite weights in random.choices().  
(GH-22441)
https://github.com/python/cpython/commit/b0dfc7581697f20385813582de7e92ba6ba0105f


--

___
Python tracker 

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



[issue40554] Add escape to the glossary?

2020-09-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

s/rely/read/

--

___
Python tracker 

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



[issue41873] Add vectorcall for float()

2020-09-28 Thread Dong-hee Na


Dong-hee Na  added the comment:

Now float() is faster!
Thank you for your contribution, Dennis :)
And thank you Victor as co-reviewer!

--
nosy: +vstinner
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



[issue41873] Add vectorcall for float()

2020-09-28 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset e8acc355d430b45f1c3ff83312e72272262a854f by Dennis Sweeney in 
branch 'master':
bpo-41873: Add vectorcall for float() (GH-22432)
https://github.com/python/cpython/commit/e8acc355d430b45f1c3ff83312e72272262a854f


--
nosy: +corona10

___
Python tracker 

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



[issue41882] CCompiler.has_function does not delete temporary files

2020-09-28 Thread Mikhail Terekhov


Change by Mikhail Terekhov :


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

___
Python tracker 

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



[issue41882] CCompiler.has_function does not delete temporary files

2020-09-28 Thread Mikhail Terekhov


New submission from Mikhail Terekhov :

CCompiler.has_function does not delete temporary files. Depending on the 
check result it leaves temporary C source, object and executable files.

--
components: Distutils
messages: 377646
nosy: dstufft, eric.araujo, termim
priority: normal
severity: normal
status: open
title: CCompiler.has_function does not delete temporary files
type: resource usage
versions: Python 3.10, Python 3.5, 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



[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-28 Thread Samuel Freilich


Samuel Freilich  added the comment:

> I think it's reasonable to discuss the problem on python-ideas rather than on 
> a bugs issue, when it's not obvious what the right solution is.

I did start a thread there. Don't object to that, if that's a better forum for 
this sort of thing.

--

___
Python tracker 

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



[issue41871] Add PyList_Remove() in listobject.c

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

I proposed to Hai Shi in his PR to add PyList_Remove() since I was surprised 
that the feature is exposed in Python but not at the C level.

> You always can use PyObject_CallMethod(). It is not a method called in tight 
> loop for which the overhead of calling method is significant.

He reimplemented the function by copying items into a new list except of the 
item which should be removed.

I expect that PyList_SetSlice() is more efficient than creating a new list, it 
modifies the list in-place.

I'm fine with rejecting this issue.

--

___
Python tracker 

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



[issue39603] [security][ CVE-2020-26116] http.client: HTTP Header Injection in the HTTP method

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

Mauro Matteo Cascella: "CVE-2020-26116 has been requested/assigned for this 
flaw via MITRE form: https://cveform.mitre.org/ I suggest mentioning it in the 
related vulnerability page: 
https://python-security.readthedocs.io/vuln/http-header-injection-method.html;

Thanks, done.

--
title: [security] http.client: HTTP Header Injection in the HTTP method -> 
[security][ CVE-2020-26116] http.client: HTTP Header Injection in the HTTP 
method

___
Python tracker 

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



[issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-28 Thread STINNER Victor


Change by STINNER Victor :


--
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



[issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

The function is added, I close the issue. Thanks Hai Shi.

--

___
Python tracker 

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



[issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

codecs.unregister() is needed to write unit tests: see PR 19069 of bpo-39337.

I don't see a strong need to add a new codecs.unregister_error() function, 
excpet for completeness. I don't think that completeness is enough to justify 
to add the function, but feel free to open a new issue if you consider that 
it's really needed.

--

___
Python tracker 

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



[issue41881] New Line escape issue in raw strings

2020-09-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is expected behavior. \n in a raw string means two characters, backslash and 
"n", not a single newline character. Use non-raw string to embed a newline 
character.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

PR 22360 required 15 iterations (15 commits) and it changes a lot of code. I 
wouldn't say that it's an "easy (C)" issue.

--

___
Python tracker 

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



[issue41861] Convert sqlite3 to PEP 384

2020-09-28 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +21474
pull_request: https://github.com/python/cpython/pull/22444

___
Python tracker 

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



[issue40554] Add escape to the glossary?

2020-09-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I concur with Raymond. Are there problems with understanding the term "escape" 
in some context? If yes, then we perhaps need to clarify the corresponding 
place in the documentation. But if there is a problem with understanding the 
general word "escape", I think we should not do anything.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

Lukasz: Would you mind to cherry-pick the commit 
cca896e13b230a934fdb709b7f10c5451ffc25ba in 3.9.0 final?

--
priority: normal -> release blocker

___
Python tracker 

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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

FYI __builtin_unreachable() is used since this change, of bpo-38249:

commit eebaa9bfc593d5a46b293c1abd929fbfbfd28199
Author: Serhiy Storchaka 
Date:   Mon Mar 9 20:49:52 2020 +0200

bpo-38249: Expand Py_UNREACHABLE() to __builtin_unreachable() in the 
release mode. (GH-16329)

Co-authored-by: Victor Stinner 

--

___
Python tracker 

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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread miss-islington


miss-islington  added the comment:


New changeset cca896e13b230a934fdb709b7f10c5451ffc25ba by Miss Islington (bot) 
in branch '3.9':
bpo-41875: Use __builtin_unreachable when possible (GH-22433)
https://github.com/python/cpython/commit/cca896e13b230a934fdb709b7f10c5451ffc25ba


--

___
Python tracker 

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



[issue40554] Add escape to the glossary?

2020-09-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

For the reasons mentioned by Inada, I don't think this should be added.  

The term "escape" means many different things in different contexts.  To the 
extent the term needs to be defined, it should be done in the docs for those 
contexts (i.e. regular expression escapes should be talked about in the regex 
docs).

Side note:  It is not the purpose of the glossary to define every term in 
computer science.  The more fluff we add to the glossary, the harder it becomes 
to rely the glossary and learn Python specific terms.

--
nosy: +rhettinger

___
Python tracker 

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



[issue41170] Use strnlen instead of strlen when the size i known.

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

"Use strnlen instead of strlen when the size i known" rationale was "This PR 
changes strlen to strnlen so no buffer overruns are made when there's no null 
terminator", but strlen() was not called whne the string was not null 
terminated.

Serhiy wrote that strnlen() can be faster and that can be slower... If the goal 
is an optimization, a benchmark should prove it (on at least one platform).
https://github.com/python/cpython/pull/21236#issuecomment-699609949

--

___
Python tracker 

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



[issue41170] Use strnlen instead of strlen when the size i known.

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

PR 21236 was closed by his author, can this issue be closed?

--
nosy: +vstinner

___
Python tracker 

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



[issue41861] Convert sqlite3 to PEP 384

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset cb6db8b6ae47dccc1aa97830d0f05d29f31e0cbc by Erlend Egeberg 
Aasland in branch 'master':
 bpo-41861: Convert _sqlite3 PrepareProtocolType to heap type (GH-22428)
https://github.com/python/cpython/commit/cb6db8b6ae47dccc1aa97830d0f05d29f31e0cbc


--

___
Python tracker 

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



[issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset d332e7b8164c3c9c885b9e631f33d9517b628b75 by Hai Shi in branch 
'master':
bpo-41842: Add codecs.unregister() function (GH-22360)
https://github.com/python/cpython/commit/d332e7b8164c3c9c885b9e631f33d9517b628b75


--

___
Python tracker 

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



[issue41756] Do not always use exceptions to return result from coroutine

2020-09-28 Thread Vladimir Matveev


Change by Vladimir Matveev :


--
pull_requests: +21473
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/22443

___
Python tracker 

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



[issue39027] run_coroutine_threadsafe uses wrong TimeoutError

2020-09-28 Thread Nick Gaya


Nick Gaya  added the comment:

@msg358296:

> IMO, it seems rather counter-intuitive to have to specify 
> `concurrent.futures.TimeoutError` when using a timeout for the future 
> returned by `run_coroutine_threadsafe()`.

I think that's expected, given that the function returns a 
`concurrent.futures.Future` object. The `Future.result()` method behaves the 
same regardless of the executor.

@avsetlov:

> futures._chain_future() should convert exceptions. Seems 
> _convert_future_exc() does this work already but maybe it fails somehow. We 
> need to investigate more.

The `_convert_future_exc()` only converts `concurrent.futures` exceptions to 
`asyncio` exceptions, not the reverse. I'm not sure if this is intentional or 
not.

With the current behavior there are two types of timeout errors that can occur 
in the example snippet:

* If the coroutine itself throws an `asyncio.exceptions.TimeoutError`, this 
will be propagated as-is to the `concurrent.futures.Future` object and thrown 
by `future.result()`.

* If the coroutine does not terminate within the timeout supplied to 
`future.result()`, then the method will throw a 
`concurrent.futures.TimeoutError` without changing the state of the future or 
the associated coroutine.

It's only necessary to cancel the future in the second case, as in the first 
case it's already in a finished state. So the example should catch 
`concurrent.futures.TimeoutError` rather than `asyncio.TimeoutError`.

--
nosy: +nickgaya

___
Python tracker 

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



[issue40554] Add escape to the glossary?

2020-09-28 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 3.0 -> 4.0
pull_requests: +21472
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22342

___
Python tracker 

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



[issue41738] MIME type for *.zip becomes application/x-zip-compressed on Windows

2020-09-28 Thread Steve Dower


Steve Dower  added the comment:

mimetype uses the system database for MIME types, which on Windows is 
application/x-zip-compressed, so this is by design.

If you have a need to specify a MIME type that does not match the system you're 
on, you'll need your own logic.

--
resolution:  -> not a bug
stage:  -> 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



[issue38989] pip install selects 32 bit wheels for 64 bit python if vcvarsall.bat amd64_x86 in environment

2020-09-28 Thread Steve Dower


Steve Dower  added the comment:

I'm closing this as external, as the canonical source for platform tags is now 
the packaging library.

Either pip and/or distlib should switch to using that library or the logic 
included (which I'll note is considerably more complex - but also more well 
defined and tested - than what is in distutils).

--
resolution:  -> third party
stage:  -> 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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +21471
pull_request: https://github.com/python/cpython/pull/22442

___
Python tracker 

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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 24ba3b0df5e5f2f237d7b23b4017ba12f16320ae by Dong-hee Na in branch 
'master':
bpo-41875: Use __builtin_unreachable when possible (GH-22433)
https://github.com/python/cpython/commit/24ba3b0df5e5f2f237d7b23b4017ba12f16320ae


--

___
Python tracker 

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



[issue41877] Check against misspellings of assert etc. in mock

2020-09-28 Thread Vedran Čačić

Vedran Čačić  added the comment:

It would be a valid argument if the API _worked_. Obviously, it doesn't. Every 
few years, the same story repeats. "We've found even more missspellings of 
assert, we need to add them too. They cause real bugs in our tests." I have a 
strong feeling it will never end.

--

___
Python tracker 

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



[issue41881] New Line escape issue in raw strings

2020-09-28 Thread Kevin Ardath


New submission from Kevin Ardath :

When attempting to concatenate some strings with a new line, I observed that 
formatting braces in a raw string skipped a new line escape:

print(r'{{}}\nx'.format())

Produces:
{}\nx

Rather than:
{}
x

--
messages: 377624
nosy: ardath.kevin
priority: normal
severity: normal
status: open
title: New Line escape issue in raw strings
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue41851] tkinter: add font equal methods

2020-09-28 Thread Tal Einat


Change by Tal Einat :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python

___
Python tracker 

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



[issue41773] Clarify handling of infinity and nan in random.choices

2020-09-28 Thread Ram Rachum


Change by Ram Rachum :


--
keywords: +patch
pull_requests: +21470
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/22441

___
Python tracker 

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



[issue41880] Get Python include directories from sysconfigdata

2020-09-28 Thread Ben Wolsieffer


Change by Ben Wolsieffer :


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

___
Python tracker 

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



[issue40105] Updating zip comment doesn't truncate the zip file

2020-09-28 Thread miss-islington


miss-islington  added the comment:


New changeset 048f54dc75d51e8a1c5822ab7b2828295192aaa5 by Miss Islington (bot) 
in branch '3.9':
bpo-40105: ZipFile truncate in append mode with shorter comment (GH-19337)
https://github.com/python/cpython/commit/048f54dc75d51e8a1c5822ab7b2828295192aaa5


--

___
Python tracker 

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



[issue41880] Get Python include directories from sysconfigdata

2020-09-28 Thread Ben Wolsieffer


New submission from Ben Wolsieffer :

The distutils.sysconfig.get_python_inc() function finds headers relative to 
sys.base_prefix or sys.base_exec_prefix. This causes problems when 
cross-compiling extension modules because Python's headers are not platform 
independent.

Instead, get_python_inc() should use the INCLUDEPY and CONFINCLUDEPY variables 
from sysconfigdata to find headers. The _PYTHON_SYSCONFIGDATA_NAME environment 
variable can then be used to make build arch Python load sysconfigdata from 
host arch Python.

--
components: Cross-Build, Distutils
messages: 377622
nosy: Alex.Willmer, benwolsieffer, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: Get Python include directories from sysconfigdata
type: enhancement
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



[issue41879] Outdated description of async iterables in documentation of async for statement

2020-09-28 Thread Nick Gaya


New submission from Nick Gaya :

The documentation for the `async for` statement incorrectly states that "An 
asynchronous iterable is able to call asynchronous code in its iter 
implementation". Actually, this behavior was deprecated in Python 3.6 and 
removed in Python 3.7.  As of Python 3.7, the `__aiter__()` method must return 
an asynchronous iterator directly.

Suggested fix: Update the `async for` statement description for Python 3.7+ to 
match the "Asynchronous Iterators" section in the data model documentation.

> An :term:`asynchronous iterator` can call asynchronous code in its *next* 
> method.

Relevant documentation:
- 
https://docs.python.org/3/reference/compound_stmts.html#the-async-for-statement
- https://docs.python.org/3/reference/datamodel.html#asynchronous-iterators

--
assignee: docs@python
components: Documentation
messages: 377621
nosy: docs@python, nickgaya
priority: normal
severity: normal
status: open
title: Outdated description of async iterables in documentation of async for 
statement
versions: Python 3.10, 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



[issue41877] Check against misspellings of assert etc. in mock

2020-09-28 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Václav, I support your suggestion and suggest that you move forward to prepare 
a PR.

Vedran, this API has been set in stone for a long time, so changing is 
disruptive.  If you really think the API needs to be redesigned, consider 
bringing it up on python-ideas.  The proposal would need broad support to move 
forward.

--
nosy: +michael.foord, rhettinger

___
Python tracker 

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



[issue41773] Clarify handling of infinity and nan in random.choices

2020-09-28 Thread Ram Rachum


Ram Rachum  added the comment:

Sounds good, I'm on it.

--

___
Python tracker 

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



[issue41773] Clarify handling of infinity and nan in random.choices

2020-09-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I've discussed this with other developers and now agree that a test should be 
added.  While the current code's handing of Inf or NaN is correct in a 
technical sense, it is neither intuitive or useful.

Even though it will have a small time cost for the common case of two weights, 
we should add a test just after the check for the total being greater than zero:

if not _isfinite(total):
raise ValueError('Total of weights must be finite')

Also edit the docs to say:

   Weights are assumed to be non-negative and finite.

Ram, since this was your finding, do you want to make a PR for it (with a test, 
news entry, and doc edit)?

--
resolution: not a bug -> 
status: closed -> open
type: behavior -> enhancement

___
Python tracker 

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



[issue40105] Updating zip comment doesn't truncate the zip file

2020-09-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +21468
pull_request: https://github.com/python/cpython/pull/22439

___
Python tracker 

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



[issue40105] Updating zip comment doesn't truncate the zip file

2020-09-28 Thread miss-islington


miss-islington  added the comment:


New changeset e4008404fbc0002c49becc565d42e93eca11dd75 by Miss Islington (bot) 
in branch '3.8':
bpo-40105: ZipFile truncate in append mode with shorter comment (GH-19337)
https://github.com/python/cpython/commit/e4008404fbc0002c49becc565d42e93eca11dd75


--
nosy: +miss-islington

___
Python tracker 

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



[issue41878] python3 fails to use custom dict-like object as symbols in eval()

2020-09-28 Thread Robert Haschke


New submission from Robert Haschke :

The attached file implements a custom dict-like class (MyDict) as a minimal 
example of code I am using in a larger codebase. 
Before you ask, why I reimplemented a dict-like object: The real code base 
employs a hierarchical dict, referencing recursively to the parent dict, if a 
key cannot be found in the current dict.

The main code of the file defines two entries/variables for this dict:
symbols = MyDict()
symbols['abc'] = '[1, 2, 3]'
symbols['xyz'] = 'abc + abc'

and eval_text('xyz', symbols) should evaluate to the python expression as you 
would have evaluated those variables in a python interpreter.
While this works for the first given expression (above), it fails for this one:
symbols['xyz'] = '[abc[i]*abc[i] for i in [0, 1, 2]]'

raising NameError: name 'abc' is not defined.
The same code works perfectly in python 2.7. Hence, I assume this is a bug in 
python3.

--
files: buggy.py
messages: 377616
nosy: Robert Haschke
priority: normal
severity: normal
status: open
title: python3 fails to use custom dict-like object as symbols in eval()
versions: Python 3.8
Added file: https://bugs.python.org/file49476/buggy.py

___
Python tracker 

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



[issue40105] Updating zip comment doesn't truncate the zip file

2020-09-28 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +21466
pull_request: https://github.com/python/cpython/pull/22436

___
Python tracker 

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



[issue40105] Updating zip comment doesn't truncate the zip file

2020-09-28 Thread Tal Einat


Tal Einat  added the comment:

Thanks for the report and initial PR, Yudi!

Thanks for the second PR, Jan!

--
nosy:  -miss-islington
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



[issue40105] Updating zip comment doesn't truncate the zip file

2020-09-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +21467
pull_request: https://github.com/python/cpython/pull/22437

___
Python tracker 

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



[issue40105] Updating zip comment doesn't truncate the zip file

2020-09-28 Thread Tal Einat


Change by Tal Einat :


--
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



[issue40105] Updating zip comment doesn't truncate the zip file

2020-09-28 Thread Tal Einat


Tal Einat  added the comment:


New changeset ff9147d93b868f0e13b9fe14e2a76c2879f6787b by Jan Mazur in branch 
'master':
bpo-40105: ZipFile truncate in append mode with shorter comment (GH-19337)
https://github.com/python/cpython/commit/ff9147d93b868f0e13b9fe14e2a76c2879f6787b


--
nosy: +taleinat

___
Python tracker 

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



[issue41870] Use PEP 590 vectorcall to speed up calls to bool()

2020-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

You can put ok<0 test in the if (nargs) branch, to avoid the test when nargs=0.

--

___
Python tracker 

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



[issue41877] Check against misspellings of assert etc. in mock

2020-09-28 Thread Vedran Čačić

Vedran Čačić  added the comment:

How about we actually _solve_ the problem, instead of masking it with layer 
upon layer of obfuscation?

Python has standalone functions. assert_called (and company) should just be 
functions, they shouldn't be methods, and the problem is solved elegantly. The 
whole reason the problem exists in the first place is that Java, where Python 
copied the API from, has no standalone functions. In Pythonic design, the 
problem shouldn't exist at all.

--
nosy: +veky

___
Python tracker 

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



[issue41877] Check against misspellings of assert etc. in mock

2020-09-28 Thread Václav Brožek

New submission from Václav Brožek :

Recently we cleaned up the following typos in mocks in unittests of our 
codebase:

* Wrong prefixes of mock asserts: asert/aseert/assrt -> assert
* Wrong attribute names around asserts: autospect/auto_spec -> autospec, 
set_spec -> spec_set

Especially the asserts are dangerous, because a misspelled assert_called will 
fail silently. We found real bugs in production code which were masked by a 
misspelled assert_called.

There is prior work done to report similar cases of assert misspellings with an 
AttributeError: 
https://github.com/testing-cabal/mock/commit/7c530f0d9aa48d2538501761098df7a5a8979a7d,
 and adding new cases will be an easy change. I suppose that adding similar 
error signalling for the wrong argument names will not be much harder.

I'm prepared to implement it, if people of this project would be happy to have 
such checks.

--
components: Library (Lib)
messages: 377611
nosy: vabr2
priority: normal
severity: normal
status: open
title: Check against misspellings of assert etc. in mock
type: enhancement
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



[issue37294] concurrent.futures.ProcessPoolExecutor state=finished raised error

2020-09-28 Thread DanilZ


DanilZ  added the comment:

After executing a single task inside a process the result is returned with 
state=finished raised error.

Error happens when trying to load a big dataset (over 5 GB). Otherwise the same 
dataset reduced to a smaller nrows executes and returns from result() without 
errors.

with concurrent.futures.ProcessPoolExecutor(max_workers = 1) as executor:
results = executor.submit(pd.read_csv, path)

data = results.result()

--
components: +2to3 (2.x to 3.x conversion tool) -Library (Lib)
nosy: +DanilZ
title: concurrent.futures.ProcessPoolExecutor and multiprocessing.pool.Pool 
fail with super -> concurrent.futures.ProcessPoolExecutor state=finished raised 
error

___
Python tracker 

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



[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-28 Thread Irit Katriel


Irit Katriel  added the comment:

I think it's reasonable to discuss the problem on python-ideas rather than on a 
bugs issue, when it's not obvious what the right solution is.

--

___
Python tracker 

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



[issue41756] Do not always use exceptions to return result from coroutine

2020-09-28 Thread Vladimir Matveev


Vladimir Matveev  added the comment:

No, I don't think so but I can definitely make one. A few questions first:
- having PySendResult as a result type of PyIterSend seems ok, however prefix 
for each concrete value (PYGEN_*) is not aligned with the prefix of the 
function itself (PyIter_)
- should it also deal with tstate->c_tracefunc (probably not) or just be 
something like
```
PySendResult
PyIter_Send(PyObject *iter, PyObject *arg, PyObject **result)
{
_Py_IDENTIFIER(send);
assert(result != NULL);

if (PyGen_CheckExact(iter) || PyCoro_CheckExact(iter)) {
return PyGen_Send((PyGenObject *)iter, arg, result);
}

if (arg == Py_None && Py_TYPE(iter)->tp_iternext != NULL) {
*result = Py_TYPE(iter)->tp_iternext(iter);
}
else {
*result = _PyObject_CallMethodIdOneArg(iter, _send, arg);
}

if (*result == NULL) {
if (_PyGen_FetchStopIterationValue(result) == 0) {
return PYGEN_RETURN;
}
return PYGEN_ERROR;
}
return PYGEN_NEXT;
}
```

--

___
Python tracker 

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



[issue14527] How to link with a non-system libffi?

2020-09-28 Thread pmp-p


Change by pmp-p :


--
nosy: +pmpp

___
Python tracker 

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



[issue41851] tkinter: add font equal methods

2020-09-28 Thread E. Paine


Change by E. Paine :


--
pull_requests: +21465
pull_request: https://github.com/python/cpython/pull/22434

___
Python tracker 

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



[issue39603] [security] http.client: HTTP Header Injection in the HTTP method

2020-09-28 Thread Larry Hastings


Larry Hastings  added the comment:

> Also note that httplib (python-2.7.18) seems to be affected too. Any 
> particular reason for it not to be listed in the same vulnerability page?

Yes: 2.7 has been end-of-lifed and is no longer supported.

--

___
Python tracker 

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



[issue41870] Use PEP 590 vectorcall to speed up calls to bool()

2020-09-28 Thread Dong-hee Na


Dong-hee Na  added the comment:

Now I close this issue.
Thank you, Mark!

--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue41870] Use PEP 590 vectorcall to speed up calls to bool()

2020-09-28 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset a195bceff7b552c5f86dec7894ff24dcc87235da by Dong-hee Na in branch 
'master':
bpo-41870: Use PEP 590 vectorcall to speed up bool()  (GH-22427)
https://github.com/python/cpython/commit/a195bceff7b552c5f86dec7894ff24dcc87235da


--

___
Python tracker 

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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread Dong-hee Na


Dong-hee Na  added the comment:

I am able to reproduce this issue on my gcc 4.4.7

root@ef9b356a9deb:/home/cpython# gcc --version
gcc (Ubuntu/Linaro 4.4.7-8ubuntu7) 4.4.7
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

Objects/abstract.c: In function '_PySequence_IterSearch':
Objects/abstract.c:2065: error: implicit declaration of function 
'__builtin_unreachable'
Makefile:1751: recipe for target 'Objects/abstract.o' failed
make: *** [Objects/abstract.o] Error 1

And with PR 22433, I am success to build and run test.


I 'd like to send backport patch into 3.9 also

--
nosy: +lukasz.langa

___
Python tracker 

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



[issue41876] Add __repr__ for Tkinter Font objects

2020-09-28 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Currently Font objects have default repr:



Since Font is just an object oriented wrapper for font name, and Font objects 
with the same name are equal, it is worth to show the font name in the repr and 
do not show an id.



--
components: Tkinter
keywords: easy
messages: 377603
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Add __repr__ for Tkinter Font objects
type: enhancement
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



[issue41851] tkinter: add font equal methods

2020-09-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I concur with Tal that negating size would be useless feature, and that we do 
not need an alternate equal() method. When we want to test that two strings are 
equal ignoring case we do not call a special method equalignorecase(), we just 
test that s1.casefold() == s2.casefold().

But I disagree that Font.__eq__() should be changed. The Font object is just a 
reference to the Tk font as the Path object is a reference to a file on 
filesystem. When we compare two Path objects we do not compare file sizes, 
modification times, permission bits and content. We just compare two full 
names. If two Path objects has the same full name, they are equal. If they full 
names are different, they are different, even if the corresponding files has 
the same content. The same is with Font objects.

--

___
Python tracker 

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



[issue41859] Uncaught ValueError

2020-09-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Reports with a reproducer are also helpful.

Again, can you get a completion box at all?

--

___
Python tracker 

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



[issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Although unregistering an error handler may be not so easy, so it is better to 
open a separate issue for it.

--
keywords: +easy (C) -patch

___
Python tracker 

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



[issue14527] How to link with a non-system libffi?

2020-09-28 Thread pmp-p


Change by pmp-p :


--
nosy:  -pmpp

___
Python tracker 

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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread Dong-hee Na


Change by Dong-hee Na :


--
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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +serhiy.storchaka, vstinner

___
Python tracker 

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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-28 Thread Samuel Freilich


Samuel Freilich  added the comment:

> No minor tweak to the exception message will make this go away.  For 
> understanding to occur, the only way to forward is to learn a bit about 
> hashability.  That is a step that every beginner must take.

This is a derisive and beginner-hostile response that ignores half of what's 
been said by other participants in this thread.

> Also the error message itself is easily Googled

Yeah, the first thing that comes up is ~4k Stack Overflow entries where people 
are really confused by the error message.

--

___
Python tracker 

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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue41838] Value error is showing in docset python (class)

2020-09-28 Thread Eric V. Smith

Eric V. Smith  added the comment:

If you can provide the information requested, please reopen this issue. In the 
meantime, I’m closing it.

--
resolution:  -> rejected
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



[issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-28 Thread hai shi


hai shi  added the comment:

oh, sorry, typo error. multiple search functions-->multiple error handler.

--

___
Python tracker 

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



[issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-28 Thread hai shi


hai shi  added the comment:

> If add a function for unregistering a codec search function, it would be 
> worth to add also a function for unregistering an error handler.

Registering an error handler have no refleaks when registering multiple search 
functions.
+1 if end user need this function.

--

___
Python tracker 

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



[issue39027] run_coroutine_threadsafe uses wrong TimeoutError

2020-09-28 Thread pfctdayelise


pfctdayelise  added the comment:

Can we at least update the docs in the meantime? It's not great having 
incorrect docs. Then if a fix is made to revert the behaviour, it can include 
updating the docs back.

--
nosy: +pfctdayelise

___
Python tracker 

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



[issue41875] __builtin_unreachable error in gcc 4.4.5

2020-09-28 Thread yota moteuchi

New submission from yota moteuchi :

While compiling a very recent release of Python (ie. 3.9.0rc2) with a fairly 
old release of gcc (ie. debian 6.0.6 gcc 4.4.5) I get the following error :

gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall 
   -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers -Werror=implicit-function-declaration 
-fvisibility=hidden  -I./Include/internal  -I. -I./Include-DPy_BUILD_CORE 
-o Parser/pegen/pegen.o Parser/pegen/pegen.c

Parser/pegen/pegen.c: In function ‘_PyPegen_seq_count_dots’:
Parser/pegen/pegen.c:1414: error: implicit declaration of function 
‘__builtin_unreachable’

Indeed, this '__builtin_unreachable()' function will exists starting from gcc 
4.5.

The configure file could detect this and offer an alternative.

(does a table of the supported gcc release for each python versions exists ?)

--
components: Build
messages: 377594
nosy: yota moteuchi
priority: normal
severity: normal
status: open
title: __builtin_unreachable error in gcc 4.4.5
type: compile error
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



[issue41874] datetime.strptime raises error if date is before 1900

2020-09-28 Thread Red Rooster


Red Rooster  added the comment:

The issue is not that the date is before 1900, the issue are german month 
names. That strptime understands them, first set the locale like that:
locale.setlocale(locale.LC_TIME, "de_DE")

--
resolution:  -> not a bug
stage:  -> 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



[issue41874] datetime.strptime raises error if date is before 1900

2020-09-28 Thread Red Rooster


New submission from Red Rooster :

This fails, because the date is before 1900:
d = datetime.strptime("28. Februar 1899", '%d. %B %Y')

But the opposite conversion direction works:
d=datetime(1899,2,28)
d.strftime('%d. %B %Y')

prints out "28. Februar 1899" as it should be.

--
components: Library (Lib)
messages: 377592
nosy: redrooster
priority: normal
severity: normal
status: open
title: datetime.strptime raises error if date is before 1900
type: behavior
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



[issue24427] subclass of multiprocessing Connection segfault upon attribute acces

2020-09-28 Thread Irit Katriel


Irit Katriel  added the comment:

The fact that a bug was discovered a long time ago doesn't say anything about 
its relevance (hence old issues are not automatically closed). 

In this case I believe the bug is no longer relevant and therefore the issue 
can be closed.

--

___
Python tracker 

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



[issue41873] Add vectorcall for float()

2020-09-28 Thread Dennis Sweeney


Change by Dennis Sweeney :


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

___
Python tracker 

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



[issue41873] Add vectorcall for float()

2020-09-28 Thread Dennis Sweeney


New submission from Dennis Sweeney :

I got these benchmarks:

.\python.bat -m pyperf timeit "float(0)"

Before: Mean +- std dev: 79.0 ns +- 1.0 ns
After:  Mean +- std dev: 51.5 ns +- 1.6 ns

--
components: Interpreter Core
messages: 377590
nosy: Dennis Sweeney
priority: normal
severity: normal
status: open
title: Add vectorcall for float()
type: performance
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



[issue41851] tkinter: add font equal methods

2020-09-28 Thread Tal Einat


Tal Einat  added the comment:

P.P.S. Re-reading that piece of code for IDLE's font config dialog, that 
actually looks to be intentional and correct.

--

___
Python tracker 

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



[issue41851] tkinter: add font equal methods

2020-09-28 Thread Tal Einat


Tal Einat  added the comment:

> > I also think using [.equal] wouldn't add anything

> I disagree and will stand by this one!

Please do note that the full quote was "I also think using it wouldn't add 
anything, and would be less clear, compared to font1.actual() == 
font2.actual()".

> I think it would be helpful to have a convenience method to check if two 
> fonts represent the same thing that is displayed to the user.

More convenient than font1.actual() == font2.actual() ?

Since this will be used rather rarely, IMO the more significant problem is 
discoverability - I've done a *lot* of work with Tkinter and had never heard of 
the .actual() method. However, adding another comparison method won't help with 
that by itself.

> I am reluctant to touch __eq__. Any ideas?

You wrote that "Checking to see if the fonts are the same Tk object is also 
very helpful (in other, granted fewer, contexts)": Could you elaborate on that?

I still think we should consider overriding __eq__. But I need to check how 
consistent Tktinter is regarding __eq__ checking whether two objects have the 
same name.


[goes to check the docs, code, and do some interactive investigation...]


Okay, so the Font class's .name attribute is just a name the user gives to a 
certain font configuration, which is supposed to be unique. Our docs are pretty 
clear about this:

"The Font class represents a named font. Font instances are given unique names 
and can be specified by their family, size, and style configuration. Named 
fonts are Tk's method of creating and identifying fonts as a single object, 
rather than specifying a font by its attributes with each occurrence." So in 
this case, tkinter is letting a particularly confusing Tk detail show through.

Note that providing a name isn't required, and how confusing the result is when 
not providing font names:

>>> Font(family='DejaVu Sans', size=12) == Font(family='DejaVu Sans', size=12)
False

Also, if you happen to try to create a font with a name which has already been 
used:

>>> Font(name='default font', family='DejaVu Sans', size=12)

>>> Font(name='default font', family='DejaVu Sans', size=12)
Traceback [...]
_tkinter.TclError: named font "default font" already exists

One can avoid this error by passing exists=True, but using that when the font 
doesn't exist raises an exception:

>>> Font(name='other font', family='DejaVu Sans', size=10, exists=True)
Traceback [...]
_tkinter.TclError: named font other font does not already exist


My point is: Using named fonts in tkinter seems incredibly annoying. Using 
fonts without names seems to work better. But without using names, font 
comparison is meaningless.

It seems to me that we could change __eq__ to:
1. Keep the current behavior if both font objects have explicitly set names or 
if their automatically generated names are equal (i.e. `self is other`).
2. Otherwise, compare the the results of calling their .actual() methods.

This would require adding a simple internal flag in __init__ to remember 
whether the name was set explicitly, since __init__ sets a unique name if not 
provided with one.



P.S. The "name" constructor parameter is confusing! Here even Terry J. Reedy 
got it wrong in IDLE font configuration dialog's code:
https://github.com/python/cpython/blob/d9ab95ff1fe81efdf70e545d536d9f6927d1ba81/Lib/idlelib/config.py#L745)

--

___
Python tracker 

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



[issue41756] Do not always use exceptions to return result from coroutine

2020-09-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

No, I meant a function which combines PyGen_Send, tp_iternext and 
_PyGen_FetchStopIterationValue. Was not it in your PR?

--

___
Python tracker 

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



[issue39603] [security] http.client: HTTP Header Injection in the HTTP method

2020-09-28 Thread Mauro Matteo Cascella


Mauro Matteo Cascella  added the comment:

Hello,

CVE-2020-26116 has been requested/assigned for this flaw via MITRE form: 
https://cveform.mitre.org/

I suggest mentioning it in the related vulnerability page: 
https://python-security.readthedocs.io/vuln/http-header-injection-method.html

Also note that httplib (python-2.7.18) seems to be affected too. Any particular 
reason for it not to be listed in the same vulnerability page?

Thank you,

--
nosy: +mcascella

___
Python tracker 

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