[issue39375] Document os.environ[x] = y and os.putenv() as thread unsafe

2020-01-22 Thread Eryk Sun


Eryk Sun  added the comment:

> no need to remove that message.  

I was discussing the wrong API. It's not directly relevant that Windows API 
functions that access the process environment are protected by the PEB lock. 
Python primarily uses [_w]environ, a copy of the process environment that's 
managed by the C runtime library (ucrt). os.putenv modifies this environment 
via _wputenv. (Ultimately this syncs with the process environment by calling 
SetEnvironmentVariableW.)

Functions that modify and read ucrt's environment are protected by a lock. But 
there's still a concern if multithreaded code reads or modifies [_w]environ 
concurrent to a _[w]putenv call. Also, [_w]getenv returns a pointer to the 
value in [_w]environ, so it has the same problem. A significant difference, 
however, is that _[w]putenv in ucrt is not POSIX compliant, since it copies the 
caller's string. Also, ucrt has safer [_w]getenv_s and _[w]dupenv_s functions 
that return a copy.

--

___
Python tracker 

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



[issue38860] GenericPyCData_new does not invoke new or init

2020-01-22 Thread Justin Capella


Justin Capella  added the comment:

Becca were you still interested in this issue? 

Anyone agree the unit test seems to have a bug if that is intended behavior?

Is there a better forum for discussion about design/behavior, maybe the more 
generic issue of GenericPyCData_new using tp_alloc instead of tp_new

--

___
Python tracker 

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



[issue39397] Mac : fail to launch Python 3.8

2020-01-22 Thread Sebastien Foo


Sebastien Foo  added the comment:

Thanks a lot for you help, my issue is solved.
My ~/.zshrc was having a LANG env var set to
 
LANG=en_US

I just commented out this line and everything works fine.
I don't know why this was set like that.

Thanks again for your time you can close this ticket.

--

___
Python tracker 

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



[issue39417] Link to "Python Packaging User Guide: Creating and using virtual environments" is broken

2020-01-22 Thread Angel Cervera Claudio


New submission from Angel Cervera Claudio :

The link "See also: Python Packaging User Guide: Creating and using virtual 
environments" Is broken.

The problem is in line 30 of 
https://github.com/python/cpython/blob/3.8/Doc/library/venv.rst

I don't know the right link, so I can not fix it.

I any one provive me the right link, I can create a PR.

--
assignee: docs@python
components: Documentation
messages: 360454
nosy: angelcervera, docs@python
priority: normal
severity: normal
status: open
title: Link to "Python Packaging User Guide: Creating and using virtual 
environments" is broken
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



[issue39417] Link to "Python Packaging User Guide: Creating and using virtual environments" is broken

2020-01-22 Thread Ammar Askar


Ammar Askar  added the comment:

Hi Angel, thank you for the report! The file that corresponds to that 
documentation is here 
https://github.com/python/cpython/blob/master/Doc/library/venv.rst and we'd be 
happy to have you make a PR for it :)

--
nosy: +ammar2

___
Python tracker 

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



[issue39417] Link to "Python Packaging User Guide: Creating and using virtual environments" is broken

2020-01-22 Thread Ammar Askar


Ammar Askar  added the comment:

Oh and I think the new link should point here: 
https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment

--

___
Python tracker 

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



[issue39377] json.loads encoding parameter deprecation removal in Python 3.9

2020-01-22 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 5bbac8cbdf140ebce446ea4e7db2b20a5d7b8402 by Inada Naoki in branch 
'master':
bpo-39377: json: Update doc about the encoding option. (GH-18076)
https://github.com/python/cpython/commit/5bbac8cbdf140ebce446ea4e7db2b20a5d7b8402


--

___
Python tracker 

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



[issue39377] json.loads encoding parameter deprecation removal in Python 3.9

2020-01-22 Thread Inada Naoki


Change by Inada Naoki :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue39411] pyclbr rewrite using AST

2020-01-22 Thread Batuhan


Batuhan  added the comment:

Thanks for the suggestions Terry, I didn't want to change any behavior or make 
any feature addition (except is_async as stated in issue description) in this 
PR. 

> The change is needed 2 other places.  Could be part of this PR or another one.

I have a friend who would like to make his first contribution, so if it is not 
going to be problem, he'll take care of class browser references.

> Possible API changes based on IDLE module browser experience

Yes, it would be way better use tree/node structre instead of returning raw 
dictionaries. I can draft something after PR 1803 is merged. 

I dont have much experience of IDLE's architecture, but I can try to help if 
you want on the 4th point. 


Another thing I was considering is deprecating `readmodule` function, as you 
stated it is now module browser not class browser and `readmodule_ex` is 
sufficient. I dont know if any core developer will sponsor this idea, but I 
think `readmodule` should die. Thanks again for the suggestions and PR reviews.

--
nosy: +BTaskaya

___
Python tracker 

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



[issue39418] str.strip() should have a means of adding to the default behaviour

2020-01-22 Thread Natalie Amery


New submission from Natalie Amery :

If I want to remove the default set of 'whitespace' characters plus something 
else from a string there's currently no way to cleanly specify that.  In 
addition there's no way to programatically acquire what characters are 
considered whitespace so you can't call split with an argument constructed of 
existing whitespace characters with the new things you need.

As an example you could have an additionally= parameter such that:

"   ( 123 )   ".strip() gives "( 123 )" and
"   ( 123 )   ".strip(additionally="()") gives "123"

I've not given that any thought so it's probably not the best way of solving 
the problem.

--
messages: 360459
nosy: senji
priority: normal
severity: normal
status: open
title: str.strip() should have a means of adding to the default behaviour
type: enhancement
versions: Python 2.7, 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



[issue39418] str.strip() should have a means of adding to the default behaviour

2020-01-22 Thread Natalie Amery


Natalie Amery  added the comment:

Oops, sorry, that should say 'strip' througout not 'split'.  My bad.

--

___
Python tracker 

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



[issue39418] str.strip() should have a means of adding to the default behaviour

2020-01-22 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

This is a new feature, not a bug, so it will apply only to 3.9. All older 
versions are in feature freeze.

> there's no way to programatically acquire what characters are considered 
> whitespace

https://docs.python.org/3/library/stdtypes.html#str.isspace

https://docs.python.org/3/library/string.html#string.whitespace

--
nosy: +steven.daprano
versions:  -Python 2.7, Python 3.5, 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



[issue39397] Mac : fail to launch Python 3.8

2020-01-22 Thread Inada Naoki


Change by Inada Naoki :


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



[issue39413] Implement os.unsetenv() on Windows

2020-01-22 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset f84f65be5602e561fef04b66bb487fbc4e560db5 by Victor Stinner in 
branch '3.8':
bpo-39413: os.unsetenv() is not available on Windows (GH-18108)
https://github.com/python/cpython/commit/f84f65be5602e561fef04b66bb487fbc4e560db5


--

___
Python tracker 

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



[issue39413] Implement os.unsetenv() on Windows

2020-01-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17501
pull_request: https://github.com/python/cpython/pull/18114

___
Python tracker 

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



[issue39413] Implement os.unsetenv() on Windows

2020-01-22 Thread miss-islington


miss-islington  added the comment:


New changeset 570724667d37fcb160cdef2b34190dc36e28155c by Miss Islington (bot) 
in branch '3.7':
bpo-39413: os.unsetenv() is not available on Windows (GH-18108)
https://github.com/python/cpython/commit/570724667d37fcb160cdef2b34190dc36e28155c


--
nosy: +miss-islington

___
Python tracker 

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



[issue39413] Implement os.unsetenv() on Windows

2020-01-22 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17502
pull_request: https://github.com/python/cpython/pull/18115

___
Python tracker 

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



[issue39418] str.strip() should have a means of adding to the default behaviour

2020-01-22 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

There's a discrepancy between the string.whitespace constant and actual 
whitespace as tested by the str.isspace() method.

I've found five ASCII whitespace characters (as reported by isspace) which 
aren't in the string.whitespace constant, and 18 non-ASCII whitespace 
characters which aren't in the string.

The good news is that there are no non-whitespace characters in the constant :-)

The non-ASCII ones probably don't matter, as string.whitespace is documented as 
only being ASCII. But the following are missing:

U+001C, U+001D, U+001E, U+001F, U+0085

--

___
Python tracker 

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



[issue39416] Document default numeric string formats

2020-01-22 Thread Karl O. Pinc


Karl O. Pinc  added the comment:

On Wed, 22 Jan 2020 06:09:41 +
"Eric V. Smith"  wrote:

> Eric V. Smith  added the comment:
> 
> Is the lack of this documentation causing some confusion somewhere?
> This isn't rhetorical, I'm genuinely curious what problem you're
> trying to solve.

I'd say no, there's no real confusion anywhere.

This started with a search for documentation on Python's
default string representation for float.  This accidentally
wound up on the python-dev mailing list and became a
more general discussion during which I suggested that
some fundamentals are clear.  This is pretty much just
a follow-up to that discussion.

> Is there any mainstream programming language where the basics of what
> you've laid out aren't true? It all seems pretty obvious to me. For
> example, I can't see anyone looking at this and saying "Ah, base 10.
> That's why it's producing the output I'm seeing."

Well, I just got done looking at YAML which has a lot of base-related
syntax including base 60.  :)

The problem that would be solved is that it's easy to rely
on the default Numeric output formats.  Most output probably
does not go through a formatter, although this may change
now that f-strings are so easy.  Anyway, this would guarantee
"normal output" for numbers, even when switching between
Python implementations.

Likewise, immutability of value when round-tripping through a
string is also obvious.  But is still an important property.

So if these properties are important then include them in the spec.
That's what specs are for.  (I could probably find some non-mainstream
languages (scheme perhaps) that have specs which include
similar documentation.  You pretty have to have a formatter
in compiled languages, so those won't specify a default.
Anyway, it shouldn't matter what other language specs do.)

I understand if nobody sees this as a real problem.  And
I don't want to stand up as a big proponent.  I'll
point out the argument here and let others decide.

Regards,

Karl 
Free Software:  "You don't pay back, you pay forward."
 -- Robert A. Heinlein

--

___
Python tracker 

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



[issue39418] str.strip() should have a means of adding to the default behaviour

2020-01-22 Thread Natalie Amery


Natalie Amery  added the comment:

https://bugs.python.org/issue25433 has a summary of the issue about what 
actually constitutes whitespace from the perspective of improving the 
documentation. In terms of what strip does it turns out that string.whitespace 
is a red herring.

A list of whitespace characters _could_ be produced at runtime using 
str.isspace() but that would require iterating over the entire space of 
characters; which is likely to be slow as well as poor style.

--

___
Python tracker 

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



[issue39418] str.strip() should have a means of adding to the default behaviour

2020-01-22 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Attached is a script I used to test:

* that str.isspace() currently matches the definition given in the docs;

* that string.whitespace contains all whitespace characters, and nothing but 
whitespace;

* that str.strip() strips off all whitespace characters, and nothing but 
whitespace;

* that str.split() splits on all whitespace characters, and nothing but 
whitespace.

I haven't tested the .lstrip rstrip rsplit methods because I'm lazy :-)

The only test that fails is that the string.whitespace is missing some 
whitespace.

Again, because I'm lazy, I haven't written this as proper unit tests. Besides, 
it's quite likely all these things are already in the official test suite. (If 
not, I might re-write the missing parts as unit tests and submit a PR.)

--
Added file: https://bugs.python.org/file48858/test_ws.py

___
Python tracker 

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



[issue35003] Provide an option to venv to put files in a bin/ directory on Windows

2020-01-22 Thread Erik Aronesty


Erik Aronesty  added the comment:

> The Scripts/bin thing is not specific to venv - for whatever reason, the 
> original Windows implementation chose to use "Scripts" rather than "bin" 

That's irrelevant to the PR, which solves the problem in a compatible way.   
There's no compatibility issues if a link is made to the activate script, 
rather than moving the directory at all.

> My guess is you would need to propose a PEP to move *everything* over from 
> "Scripts" to "bin" in the Windows Python world

Certainly not.  That would break everything and would be a bad idea.

> This issue was already rejected before you added your PR so I'm not sure why 
> you went to the trouble of creating a PR.

Because the issue was rejected due to come conflating logic and confusion as to 
what the underlying problem and issue is.

The venv system produces files specifically for activation on Windows which 
must and should reside in the Scripts directory.

The venv system also produces files for activation in a bash (or similar) 
shell.  This *should* reside in the bin directory (there is no o/s dependency 
here), and it should *also* reside in the Scripts directory ... for 
compatibility.

Expressed that way, it's clear what the solution is.   Hence the PR.

--

___
Python tracker 

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



[issue39419] Core dump when trying to use workaround for custom warning category (Fatal Python error: init_sys_streams: can't initialize sys standard streams)

2020-01-22 Thread Gerrit Holl


New submission from Gerrit Holl :

Pythons commandline warning filter cannot currently handle custom warning 
categories.  See https://bugs.python.org/issue22543

I tried a workaround as suggested on Stack Overflow 
 to filter on a warning category 
defined in pandas.errors.__init__.py (DtypeWarning):

PYTHONPATH=/media/nas/x21324/miniconda3/envs/py37e/lib/python3.7/site-packages/pandas/
 python -Werror::errors.DtypeWarning

However, this results in a Fatal Python error and core dump:

Fatal Python error: init_sys_streams: can't initialize sys standard streams
AttributeError: module 'io' has no attribute 'OpenWrapper'

Current thread 0x7f7bb3be76c0 (most recent call first):
Aborted (core dumped)

--
messages: 360469
nosy: Gerrit.Holl
priority: normal
severity: normal
status: open
title: Core dump when trying to use workaround for custom warning category 
(Fatal Python error: init_sys_streams: can't initialize sys standard streams)
type: crash
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



[issue39082] AsyncMock is unable to correctly patch static or class methods

2020-01-22 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +17503
pull_request: https://github.com/python/cpython/pull/18116

___
Python tracker 

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



[issue39082] AsyncMock is unable to correctly patch static or class methods

2020-01-22 Thread Matt Kokotovich


Matt Kokotovich  added the comment:

I'd love to see this issue resolved, as it is keeping me from being able to 
switch to 3.8. 

I have a PR with Karthikeyan's suggestion, as I agree it makes more sense and 
could apply to more cases: https://github.com/python/cpython/pull/18116

--

___
Python tracker 

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



[issue39395] The os module should unset() environment variable at exit

2020-01-22 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
type:  -> crash
versions: +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



[issue39395] The os module should unset() environment variable at exit

2020-01-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Issue39406 is a new feature. In any case we should fix potential crash in older 
Python versions.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue39395] The os module should unset() environment variable at exit

2020-01-22 Thread STINNER Victor


Change by STINNER Victor :


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



[issue39395] The os module should unset() environment variable at exit

2020-01-22 Thread STINNER Victor


STINNER Victor  added the comment:

> Issue39406 is a new feature. In any case we should fix potential crash in 
> older Python versions.

Python 3.8 and older are not affected by this issue since they never destroy 
the posix_putenv_garbage dictionary: memory is never released.

--

___
Python tracker 

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



[issue39420] Windows: convertenviron() doesn't parse environment variables properly

2020-01-22 Thread STINNER Victor


New submission from STINNER Victor :

os.environ is created by convertenviron() of posixmodule.c. The Windows 
implementation calls _wgetenv(L"") to initialize _wenviron, and then parses the 
_wenviron string.

The _wenviron string is parsed by search for the first "=" character to split 
between the variable name and the variable value. For example, "USER=vstinner" 
is parsed as name="USER" and value="vstinner".

The problem is that the _wputenv() function allows to insert variable names 
containing the "=" character (but reject names starting with "=" character). 
Python can inherit an environment with a name containing "=".

One solution can be to use GetEnvironmentStringsW() which uses null characters 
to separate variable name and variable value. It returns a string like 
"name1\0value1\0name2\0value2\0\0": the string ends with a null character as 
well, to mark the end of the list.

https://docs.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-getenvironmentstrings?redirectedfrom=MSDN

Python 3.8 *explicitly* rejects variable names containing "=", at least on 
Windows, likely to workaround this issue. But another program can inject such 
variable in the environment.

Example with a Python modified to not reject explicitly "=" in the varaible 
name:
---
import subprocess, os, sys
os.putenv("victor=", "secret")
code = """import os; print(f"victor: {os.getenv('victor')!r}"); 
print(f"victor=: {os.getenv('victor=')!r}")"""
subprocess.run([sys.executable, "-c", code])
---

Output:
---
victor: '=secret'
victor=: None
---

Expected output:
---
victor: None
victor=: '=secret'
---

--
components: Library (Lib)
messages: 360473
nosy: vstinner
priority: normal
severity: normal
status: open
title: Windows: convertenviron() doesn't parse environment variables properly
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



[issue39421] Use-after-free in heappushpop() of heapq module

2020-01-22 Thread Dk0n9


Change by Dk0n9 :


--
components: Extension Modules
nosy: dk0n9
priority: normal
severity: normal
status: open
title: Use-after-free in heappushpop() of heapq module
type: crash
versions: 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



[issue39421] Use-after-free in heappushpop() of heapq module

2020-01-22 Thread Dk0n9

New submission from Dk0n9 :

The variable `heap` in heappushpop does not add a reference count

```c
cmp = PyObject_RichCompareBool(PyList_GET_ITEM(heap, 0), item, Py_LT);
if (cmp < 0)
return NULL;
if (cmp == 0) {
Py_INCREF(item);
return item;
}
```

POC:
```python
import heapq

class h(int):
def __lt__(self, o):
list1.clear()
return NotImplemented

list1 = []

heapq.heappush(list1, h(0))
heapq.heappushpop(list1, 1)
```


Crash detail with asan:

==62141==ERROR: AddressSanitizer: heap-use-after-free on address 0x606fd778 
at pc 0x0049cdce bp 0x7ffe9690f650 sp 0x7ffe9690f640
READ of size 8 at 0x606fd778 thread T0
#0 0x49cdcd in long_richcompare Objects/longobject.c:3047
#1 0x4f9495 in do_richcompare Objects/object.c:802
#2 0x4f9495 in PyObject_RichCompare Objects/object.c:846
#3 0x4f9495 in PyObject_RichCompareBool Objects/object.c:868
#4 0x7ff74c523594 in _heapq_heappushpop_impl 
/home/**/Python-3.9.0a2/Modules/_heapqmodule.c:267
#5 0x7ff74c523594 in _heapq_heappushpop 
/home/**/Python-3.9.0a2/Modules/clinic/_heapqmodule.c.h:109
#6 0x854c30 in cfunction_vectorcall_FASTCALL Objects/methodobject.c:366
#7 0x443885 in _PyObject_VectorcallTstate Include/cpython/abstract.h:111
#8 0x443885 in _PyObject_Vectorcall Include/cpython/abstract.h:120
#9 0x443885 in call_function Python/ceval.c:4850
#10 0x443885 in _PyEval_EvalFrameDefault Python/ceval.c:3306
#11 0x5e1d76 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:43
#12 0x5e1d76 in _PyEval_EvalCode Python/ceval.c:4142
#13 0x5e2207 in _PyEval_EvalCodeWithName Python/ceval.c:4174
#14 0x5e2207 in PyEval_EvalCodeEx Python/ceval.c:4190
#15 0x5e2207 in PyEval_EvalCode Python/ceval.c:717
#16 0x6862fc in run_eval_code_obj Python/pythonrun.c:1125
#17 0x6862fc in run_mod Python/pythonrun.c:1147
#18 0x6862fc in PyRun_FileExFlags Python/pythonrun.c:1063
#19 0x6867b2 in PyRun_SimpleFileExFlags Python/pythonrun.c:428
#20 0x446495 in pymain_run_file Modules/main.c:369
#21 0x446495 in pymain_run_python Modules/main.c:553
#22 0x446495 in Py_RunMain Modules/main.c:632
#23 0x446f86 in pymain_main Modules/main.c:662
#24 0x446f86 in Py_BytesMain Modules/main.c:686
#25 0x7ff74f34882f in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#26 0x78 in _start (/home/***/Python-3.9.0a2/python+0x78)

0x606fd778 is located 24 bytes inside of 56-byte region 
[0x606fd760,0x606fd798)
freed by thread T0 here:
#0 0x7ff7500b72ca in __interceptor_free 
(/usr/lib/x86_64-linux-gnu/libasan.so.2+0x982ca)
#1 0x52a5d9 in subtype_dealloc Objects/typeobject.c:1291
#2 0x4222a6 in _Py_DECREF Include/object.h:478
#3 0x4222a6 in frame_dealloc Objects/frameobject.c:636
#4 0x422088 in _Py_DECREF Include/object.h:478
#5 0x422088 in function_code_fastcall Objects/call.c:335
#6 0x53aac6 in _PyObject_VectorcallTstate Include/cpython/abstract.h:111
#7 0x53aac6 in vectorcall_unbound Objects/typeobject.c:1459
#8 0x53aac6 in slot_tp_richcompare Objects/typeobject.c:6703
#9 0x4f921d in do_richcompare Objects/object.c:796
#10 0x4f921d in PyObject_RichCompare Objects/object.c:846
#11 0x4f921d in PyObject_RichCompareBool Objects/object.c:868
#12 0x7ff74c523594 in _heapq_heappushpop_impl 
/home/**/Python-3.9.0a2/Modules/_heapqmodule.c:267
#13 0x7ff74c523594 in _heapq_heappushpop 
/home/**/Python-3.9.0a2/Modules/clinic/_heapqmodule.c.h:109
#14 0x854c30 in cfunction_vectorcall_FASTCALL Objects/methodobject.c:366
#15 0x443885 in _PyObject_VectorcallTstate Include/cpython/abstract.h:111
#16 0x443885 in _PyObject_Vectorcall Include/cpython/abstract.h:120
#17 0x443885 in call_function Python/ceval.c:4850
#18 0x443885 in _PyEval_EvalFrameDefault Python/ceval.c:3306
#19 0x5e1d76 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:43
#20 0x5e1d76 in _PyEval_EvalCode Python/ceval.c:4142
#21 0x5e2207 in _PyEval_EvalCodeWithName Python/ceval.c:4174
#22 0x5e2207 in PyEval_EvalCodeEx Python/ceval.c:4190
#23 0x5e2207 in PyEval_EvalCode Python/ceval.c:717
#24 0x6862fc in run_eval_code_obj Python/pythonrun.c:1125
#25 0x6862fc in run_mod Python/pythonrun.c:1147
#26 0x6862fc in PyRun_FileExFlags Python/pythonrun.c:1063
#27 0x6867b2 in PyRun_SimpleFileExFlags Python/pythonrun.c:428
#28 0x446495 in pymain_run_file Modules/main.c:369
#29 0x446495 in pymain_run_python Modules/main.c:553
#30 0x446495 in Py_RunMain Modules/main.c:632
#31 0x446f86 in pymain_main Modules/main.c:662
#32 0x446f86 in Py_BytesMain Modules/main.c:686
#33 0x7ff74f34882f in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

previously allocated by thread T0 here:
#0 0x7ff7500b7602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x6dbfd5 in _PyObject_GC_Alloc Modules/gcmodule.c:2146

[issue35182] Popen.communicate() breaks when child closes its side of pipe but not exits

2020-01-22 Thread Alex Rebert


Change by Alex Rebert :


--
pull_requests: +17504
pull_request: https://github.com/python/cpython/pull/18117

___
Python tracker 

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



[issue39421] Use-after-free in heappushpop() of heapq module

2020-01-22 Thread Dong-hee Na


Dong-hee Na  added the comment:

Reproducible.

It looks similar to bpo-38588.
We will apply the same solution as we did at bpo-38588?
or do we plan to apply the solution which is suggested on msg359023?

--
nosy: +corona10, inada.naoki, pablogsal

___
Python tracker 

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



[issue39421] Use-after-free in heappushpop() of heapq module

2020-01-22 Thread Dong-hee Na


Change by Dong-hee Na :


--
stage:  -> needs patch
versions:  -Python 3.6

___
Python tracker 

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



[issue39421] Use-after-free in heappushpop() of heapq module

2020-01-22 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +vstinner

___
Python tracker 

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



[issue39408] Add support for SQLCipher

2020-01-22 Thread Manjusaka


Manjusaka  added the comment:

To be serious, I don't think using SQLCipher is a good idea for CPython

Cause, SQLCipher is always released by the source code, not the binary. That 
means we should compile and manage the binary on different platforms, sush as 
ffi on windows, Openssl on Windows.


I think that will bring in some substantial compatibility problems.

I think the ROI is not enough to make this change.

--
nosy: +Manjusaka

___
Python tracker 

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



[issue39421] Use-after-free in heappushpop() of heapq module

2020-01-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

To be honest, given how many ways this bug happens I think its time to consider 
msg359023.

--

___
Python tracker 

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



[issue39421] Use-after-free in heappushpop() of heapq module

2020-01-22 Thread Dong-hee Na


Dong-hee Na  added the comment:

> To be honest, given how many ways this bug happens I think its time to 
> consider msg359023.

+1 to me also

--

___
Python tracker 

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



[issue39421] Use-after-free in heappushpop() of heapq module

2020-01-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

AS this discussion will take a while and likely will have deeper consequences, 
in the meantime I created PR18118 to specifically fix this.

--
stage: patch review -> needs patch

___
Python tracker 

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



[issue39421] Use-after-free in heappushpop() of heapq module

2020-01-22 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +17505
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/18118

___
Python tracker 

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



[issue39422] datetime.datetime.strptime incorrectly interpretting format '%Y%m%d'

2020-01-22 Thread Cleland Loszewski


New submission from Cleland Loszewski :

```python
from datetime import datetime
print(datetime.strptime('2020016', '%Y%m%d'))
print(datetime.strptime('20200116', '%Y%m%d'))
```
The former string has a format that does not match '%Y%m%d', but the latter 
does.  Both report the same datatime output.

--
components: Library (Lib)
messages: 360480
nosy: losze1cj
priority: normal
severity: normal
status: open
title: datetime.datetime.strptime incorrectly interpretting format '%Y%m%d'
type: behavior

___
Python tracker 

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



[issue39423] Process finished with exit code -1073741819 (0xC0000005) when trying to access data from a pickled file

2020-01-22 Thread mapf


New submission from mapf :

I have a program where I create some relatively nested data and within the same 
session, I have no issues accessing the data. I then use picke.dump() with 
pickle.HIGHEST_PROTOCOL to save the data so I can access it in a later session.
These files are usually over 2GB large since they contain many images in the 
form of numpy arrays and I have never had any issues loading them. However 
there is one data structure that is a structured numpy array of type "a" with 
currently 16 different dtypes and they can all be accessed in the same session 
where they were created without any problems sometimes even after dumping and 
loading the data again. They can also all be accessed after they have been 
loaded in a different session with the exeption of one field.
This field contains rather nested data which is why I thought that this might 
be the issue, but I have honestly no idea. 
Each entry in this field is a list of len 20, whose entries are either None or 
a 1-d slice of "()"-shape from another structured array of type "b". This slice 
in turn has 37 different dtypes, most of which are either int, fload or bool. 
But there is one entry which is a list that can contain several dicts. The 
entries of this dict are floats, however one can be a slice of type "b" again, 
so there is some cross-referencing going on. As a test I already removed this 
entry though and it still crashed. 
My point is, the data that is stored is not of some crazy custom type. All the 
data is either of type bool, int, fload, list, dict or numpy.array. As I said, 
ALL the other stored data can be accessed without any problems. It is only this 
one field that can only be accessed during the same session it was created. 
My program runs using a PyQt5 GUI and I use PyCharm as the editor. I have 
already read that in the past, these two in combination seem to cause this 
error rather frequently maybe that has something to do with it. 
I have already tried reinstalling my Python distribution as well as PyCharm as 
well as running the code on a different machine to no avail. 
I am also pretty certain that this used to work just last week ago. I didn't 
change my code but now it doesn't work anymore.


Relevant specs:

Windows 10 Home 64 bit
PyCharm 2019.3.1 Professional
Python 3.7.4 via Anaconda
Numpy 1.16.5
PyQt 5.9.2

--
messages: 360481
nosy: mapf
priority: normal
severity: normal
status: open
title: Process finished with exit code -1073741819 (0xC005) when trying to 
access data from a pickled file
type: crash
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



[issue31405] shutil.which doesn't find files without PATHEXT extension on Windows

2020-01-22 Thread Manjusaka


Manjusaka  added the comment:

Hello Anthony

would you mind to execute this command on your PC?

python -c "import os; print(os.environ.get("PATHEXT", "").split(os.pathsep))"

and show the result about this code?

--
nosy: +Manjusaka

___
Python tracker 

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



[issue39422] datetime.datetime.strptime incorrectly interpretting format '%Y%m%d'

2020-01-22 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +belopolsky, p-ganssle

___
Python tracker 

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



[issue39423] Process finished with exit code -1073741819 (0xC0000005) when trying to access data from a pickled file

2020-01-22 Thread mapf


mapf  added the comment:

I forgot to mention that sometimes, when I dump and load the data in the same 
session and try to access / use the data in question, I get the following Error:

"Fatal Python error: GC object already tracked"

--

___
Python tracker 

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



[issue39421] Use-after-free in heappushpop() of heapq module

2020-01-22 Thread Dong-hee Na


Dong-hee Na  added the comment:

@pablogsal

I agree with hotfix is needed and also for discussion.
I left a comment for PR 18118. Please take a look :)

--

___
Python tracker 

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



[issue31405] shutil.which doesn't find files without PATHEXT extension on Windows

2020-01-22 Thread Anthony Sottile


Anthony Sottile  added the comment:

sure, it's the standard PATHEXT (basically a fresh vm from modern.ie) -- the 
only reason I noticed this is I was reading the source: 
https://github.com/python/cpython/blob/5bbac8cbdf140ebce446ea4e7db2b20a5d7b8402/Lib/shutil.py#L1367-L1373



C:\Users\IEUser>echo %PATHEXT%
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW

--

___
Python tracker 

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



[issue39424] test_signal: test_pidfd_send_signal() uses deprecated assertRaisesRegexp() method

2020-01-22 Thread STINNER Victor


New submission from STINNER Victor :

test_signal.test_pidfd_send_signal() should use assertRaisesRegex() rather than 
assertRaisesRegexp():

$ ./python -Werror -m test -v test_signal -m test_pidfd_send_signal 
(...)
==
ERROR: test_pidfd_send_signal (test.test_signal.PidfdSignalTest)
--
Traceback (most recent call last):
  File "/home/vstinner/python/master/Lib/test/test_signal.py", line 1292, in 
test_pidfd_send_signal
with self.assertRaisesRegexp(TypeError, "^siginfo must be None$"):
  File "/home/vstinner/python/master/Lib/unittest/case.py", line 1390, in 
deprecated_func
warnings.warn(
DeprecationWarning: Please use assertRaisesRegex instead.

--
components: Tests
keywords: newcomer friendly
messages: 360486
nosy: vstinner
priority: normal
severity: normal
status: open
title: test_signal: test_pidfd_send_signal() uses deprecated 
assertRaisesRegexp() method
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



[issue39422] datetime.datetime.strptime incorrectly interpretting format '%Y%m%d'

2020-01-22 Thread SilentGhost


SilentGhost  added the comment:

They do not "report same datetime output". Did you mean to use '20200106' as 
the second input string? Because, leading zeros being optional for certain 
format specifiers is a documented feature of strptime.

--
nosy: +SilentGhost
status: open -> pending

___
Python tracker 

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



[issue39425] list.count performance regression

2020-01-22 Thread Dong-hee Na


New submission from Dong-hee Na :

./python.exe -m pyperf timeit -s 'a = [1]*100'  'a.count(1)'

Current Master: Mean +- std dev: 1.05 us +- 0.03 us
My patch: Mean +- std dev: 423 ns +- 11 ns

This is the side-effect of pr 17022.

--
assignee: corona10
messages: 360488
nosy: corona10
priority: normal
severity: normal
status: open
title: list.count performance regression
type: performance
versions: 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



[issue39425] list.count performance regression

2020-01-22 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +inada.naoki, pablogsal, vstinner

___
Python tracker 

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



[issue39425] list.count performance regression

2020-01-22 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue38495] print built-in function docs bug

2020-01-22 Thread Julien Palard

Julien Palard  added the comment:

PR 17062 about stating it's a space by default has been rejected.

I also feel we should just enhance the space width in the prototype.

I personally see the space, but as it's in italic, I can understand it's very 
easy to miss it.

I like the `font-family: monospace, sans-serif; font-style: normal;` a lot, it 
make it clear, see screenshot, but it's an issue for python-docs-theme, opening 
it there: https://github.com/python/python-docs-theme/issues/42

--
keywords: +easy -patch
nosy: +mdk
Added file: https://bugs.python.org/file48859/Screenshot_2020-01-22 Fonctions 
natives — Documentation Python 3 8 1.png

___
Python tracker 

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



[issue39420] Windows: convertenviron() doesn't parse environment variables properly

2020-01-22 Thread Eryk Sun


Eryk Sun  added the comment:

> The problem is that the _wputenv() function allows to insert variable 
> names containing the "=" character 

No, it does not. Your experiments uncovered bugs elsewhere with the 
implementations of _wgetenv and WINAPI GetEnvironmentVariableW, but this isn't 
one of them. _wputenv(L"victor==secret") updates the OS environment by calling 
SetEnvironmentVariableW(L"victor", L"=secret"). That is the only correct 
result. A variable name is only allowed to contain "=" as the first character, 
where it is unambiguous. The first "=" beyond the first character must be the 
value delimiter.

--
nosy: +eryksun

___
Python tracker 

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



[issue39425] list.count performance regression

2020-01-22 Thread Dong-hee Na


Change by Dong-hee Na :


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



[issue39425] list.count performance regression

2020-01-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17508
pull_request: https://github.com/python/cpython/pull/18121

___
Python tracker 

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



[issue39425] list.count performance regression

2020-01-22 Thread miss-islington


miss-islington  added the comment:


New changeset 14d80d0b605d8b148e14458e4c1853a940071462 by Miss Islington (bot) 
(Dong-hee Na) in branch 'master':
bpo-39425: Fix list.count performance regression (GH-18119)
https://github.com/python/cpython/commit/14d80d0b605d8b148e14458e4c1853a940071462


--
nosy: +miss-islington

___
Python tracker 

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



[issue39425] list.count performance regression

2020-01-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17507
pull_request: https://github.com/python/cpython/pull/18120

___
Python tracker 

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



[issue39390] shutil.copytree - 3.8 changed argument types of the ignore callback

2020-01-22 Thread Manuel Barkhau


Change by Manuel Barkhau :


--
pull_requests: +17509
pull_request: https://github.com/python/cpython/pull/18122

___
Python tracker 

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



[issue35003] Provide an option to venv to put files in a bin/ directory on Windows

2020-01-22 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue39425] list.count performance regression

2020-01-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset fdb21609d944941f0732df72dc3d07a7a9a7efea by Pablo Galindo (Miss 
Islington (bot)) in branch '3.8':
bpo-39425: Fix list.count performance regression (GH-18119) (GH-18120)
https://github.com/python/cpython/commit/fdb21609d944941f0732df72dc3d07a7a9a7efea


--

___
Python tracker 

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



[issue39425] list.count performance regression

2020-01-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Thanks for the PR, Dong-hee Na :)

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



[issue39425] list.count performance regression

2020-01-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 9e06d61af30bac4fcacb7973f826147ccc010392 by Pablo Galindo (Miss 
Islington (bot)) in branch '3.7':
bpo-39425: Fix list.count performance regression (GH-18119) (GH-18121)
https://github.com/python/cpython/commit/9e06d61af30bac4fcacb7973f826147ccc010392


--

___
Python tracker 

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



[issue39422] datetime.datetime.strptime incorrectly interpretting format '%Y%m%d'

2020-01-22 Thread Cleland Loszewski


Cleland Loszewski  added the comment:

You're right, I did mean the second string to report '20200106'.  
Looking closer, I see that I was reading the documentation incorrectly and 
getting hung up on an introduced ambiguity.
```python
from datetime import datetime
print(datetime.strptime('2020016', '%Y%m%d'))
print(datetime.strptime('20200106', '%Y%m%d'))
print(datetime.strptime('202016', '%Y%m%d'))
print(datetime.strptime('2020106', '%Y%m%d'))
```

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



[issue37444] Differing exception between builtins and importlib when importing beyond top-level package

2020-01-22 Thread Brett Cannon


Brett Cannon  added the comment:

The problem with the hybrid exception is that importlib would then still raise 
a different exception from import itself, so the discrepancy would persist. And 
if you updated import you could then break people in another way where they 
were catching ValueError and ImportError separately for different cases and now 
they would potentially catch the wrong exception for that ValueError case.

Basically changing what exceptions get raised sucks as someone is almost 
inevitably broken. But since import and importlib strive to mirror each other 
as much as possible and be drop-in replacements, the consistency for the next 
30 years of Python's life is more important I think than the case of:

1. Someone using importlib.import_module()
2. Who is specifically worried about relative imports going too far and no 
other import-related import and thus only catching ValueError and not 
ImportError
3. And are supporting older versions of Python
4. And will have a difficult time updating their `except` clause to now also 
capture ImportError

--

___
Python tracker 

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



[issue39426] Pickler docstring misstates default and highest protocols

2020-01-22 Thread Mark Dickinson


New submission from Mark Dickinson :

>From the pickle.Pickler docstring:

> The optional *protocol* argument tells the pickler to use the given
> protocol; supported protocols are 0, 1, 2, 3 and 4.  The default
> protocol is 3; a backward-incompatible protocol designed for Python 3.

That's out of date since Python 3.8, where the default protocol is 4 and the 
highest available is 5. For future-proofing, it may be worth rewording the 
docstring to refer directly to the DEFAULT_PROTOCOL and HIGHEST_PROTOCOL 
constants.

--
assignee: docs@python
components: Documentation
messages: 360497
nosy: docs@python, mark.dickinson, pitrou
priority: normal
severity: normal
status: open
title: Pickler docstring misstates default and highest protocols
versions: 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



[issue39426] Pickler docstring misstates default and highest protocols

2020-01-22 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Good catch.  Do you want to submit a PR?

--

___
Python tracker 

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



[issue39426] Pickler docstring misstates default and highest protocols

2020-01-22 Thread Mark Dickinson


Mark Dickinson  added the comment:

> Do you want to submit a PR?

Not immediately. I'll add it to my to-do list, but definitely won't complain if 
someone else gets there first.

--

___
Python tracker 

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



[issue39426] Pickler docstring misstates default and highest protocols

2020-01-22 Thread Mark Dickinson


Change by Mark Dickinson :


--
assignee: docs@python -> mark.dickinson

___
Python tracker 

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



[issue39400] pydoc: Use of MANPAGER variable is incorrect

2020-01-22 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue38076] Make struct module PEP-384 compatible

2020-01-22 Thread Dino Viehland


Dino Viehland  added the comment:

With either fix, or with both, on Linux I still see this hang at shutdown.  
Victor mentioned the fact that he had to hit Ctrl-C on Linux to see this, and I 
have to do the same thing. Then with the fixes in place the original test case 
still hangs on shutdown.  

On Python 3.7 (I don't readily have 3.8 available) at least this just runs and 
completes with no ctrl-C and no crashes.  So while either of the fixes may be 
good to prevent the crashes, there's still probably some underlying issue in 
multiprocessing.  I haven't tested on Mac OS/X.

It looks like the clearing was originally introduced here: 
https://bugs.python.org/issue10241  Interestingly there was a similar issue w/ 
_tkinter, which also used PyType_FromSpec (although it sounds like it was just 
a ref count issue on the type).  Unfortunately there's no associated test cases 
added to verify the behavior.  Antoine and Neil are both now on the PR which 
removes the collection behavior so hopefully they can chime in on the safety of 
that fix.

--

___
Python tracker 

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



[issue39353] Deprecate the binhex module, binhex4 and hexbin4 standards

2020-01-22 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset beea26b57e8c80f1eff0f967a0f9d083a7dc3d66 by Victor Stinner in 
branch 'master':
bpo-39353: Deprecate the binhex module (GH-18025)
https://github.com/python/cpython/commit/beea26b57e8c80f1eff0f967a0f9d083a7dc3d66


--

___
Python tracker 

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



[issue39353] Deprecate the binhex module, binhex4 and hexbin4 standards

2020-01-22 Thread STINNER Victor


STINNER Victor  added the comment:

> I agree with deprecating binhex.

Good :-) It's now deprecated.

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



[issue39413] Implement os.unsetenv() on Windows

2020-01-22 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17511
pull_request: https://github.com/python/cpython/pull/18124

___
Python tracker 

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



[issue39361] [C API] Document PyTypeObject.tp_print removal in What's New In Python 3.9

2020-01-22 Thread Ammar Askar


Change by Ammar Askar :


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

___
Python tracker 

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



[issue39413] Implement os.unsetenv() on Windows

2020-01-22 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b73dd02ea744288831f71363a7467552c09875ea by Victor Stinner in 
branch 'master':
Revert "bpo-39413: Implement os.unsetenv() on Windows (GH-18104)" (GH-18124)
https://github.com/python/cpython/commit/b73dd02ea744288831f71363a7467552c09875ea


--

___
Python tracker 

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



[issue39406] Implement os.putenv() with setenv() if available

2020-01-22 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17513
pull_request: https://github.com/python/cpython/pull/18126

___
Python tracker 

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



[issue24337] Implement `http.client.HTTPMessage.__repr__` to make debugging easier

2020-01-22 Thread Zackery Spytz


Change by Zackery Spytz :


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

___
Python tracker 

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



[issue24337] Implement `http.client.HTTPMessage.__repr__` to make debugging easier

2020-01-22 Thread Zackery Spytz


Change by Zackery Spytz :


--
nosy: +ZackerySpytz
versions: +Python 3.9 -Python 3.5

___
Python tracker 

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



[issue24337] Implement `http.client.HTTPMessage.__repr__` to make debugging easier

2020-01-22 Thread R. David Murray


R. David Murray  added the comment:

Thanks for the PR, but I've noted an issue on the review.  In any case we 
should agree on what goes in the repr here in this issue before actually 
implementing anything.

--

___
Python tracker 

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



[issue39406] Implement os.putenv() with setenv() if available

2020-01-22 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 0852c7dd52ac42e7843ddfef44571494e4c86070 by Victor Stinner in 
branch 'master':
bpo-39406: os.putenv() avoids putenv_dict on Windows (GH-18126)
https://github.com/python/cpython/commit/0852c7dd52ac42e7843ddfef44571494e4c86070


--

___
Python tracker 

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



[issue39406] Implement os.putenv() with setenv() if available

2020-01-22 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17515
pull_request: https://github.com/python/cpython/pull/18128

___
Python tracker 

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



[issue39411] pyclbr rewrite using AST

2020-01-22 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

A separate doc change issue and PR would be fine.  Should we add a note 
explaining the module name as a contraction of an originally restricted scope?  
Make me nosy and invite review.

Actually, a doc issue for the module as is should *fully* explain readmodule_ex 
first (its entry is now incomplete), and then explain readmodule as a filtered 
version kept for back compatibility.  This could be a separate PR on the same 
issue, written by one of us, if too much for your friend.

I understood limits of this PR. I should have said change notes were intended 
for your 'second PR'. 

Changing the return value to a Module should mean a third function, which would 
then become the main function, as readmodule_ex would then be Module.children.

I have thought about making it possible to browse non-source modules, at least 
for the module being browsed.  I might implement that first in IDLE.

--

___
Python tracker 

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



[issue39425] list.count performance regression

2020-01-22 Thread STINNER Victor


STINNER Victor  added the comment:

The following result is a little bit surprising:

>>> nan=float("nan"); ([nan]*5).count(nan)
5
>>> nan == nan
False

But in fact, the optimization doesn't change the value. It was already 5 
previously.

In fact, PyObject_RichCompareBool() has a fast path if the two object pointers 
are equal:

/* Quick result when objects are the same.
   Guarantees that identity implies equality. */
if (v == w) {
if (op == Py_EQ)
return 1;
else if (op == Py_NE)
return 0;
}

In short, the optimization is good: thank you ;-)

--

___
Python tracker 

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



[issue39425] list.count performance regression

2020-01-22 Thread STINNER Victor


STINNER Victor  added the comment:

> In fact, PyObject_RichCompareBool() has a fast path if the two object 
> pointers are equal

It's documented:

https://docs.python.org/dev/c-api/object.html?highlight=pyobject_richcomparebool#c.PyObject_RichCompareBool

--

___
Python tracker 

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



[issue39406] Implement os.putenv() with setenv() if available

2020-01-22 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b477d19a6b7751b0c933b239dae4fc96dbcde9c4 by Victor Stinner in 
branch 'master':
bpo-39406: Implement os.putenv() with setenv() if available (GH-18128)
https://github.com/python/cpython/commit/b477d19a6b7751b0c933b239dae4fc96dbcde9c4


--

___
Python tracker 

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



[issue39425] list.count performance regression

2020-01-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> The following result is a little bit surprising:

haha, I went to exactly the same journey when reviewing this PR :)

--

___
Python tracker 

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



[issue39366] Remove deprecated nntplib method

2020-01-22 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 1f0f102dec506fd06f912b74dd2be64a7fba0d3f by Berker Peksag 
(Dong-hee Na) in branch 'master':
bpo-39366: Remove xpath() and xgtitle() methods of NNTP (GH-18035)
https://github.com/python/cpython/commit/1f0f102dec506fd06f912b74dd2be64a7fba0d3f


--
nosy: +berker.peksag

___
Python tracker 

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



[issue39406] Implement os.putenv() with setenv() if available

2020-01-22 Thread STINNER Victor


STINNER Victor  added the comment:

Serhiy:
> Maybe use SetEnvironmentVariable() on Windows?

In bpo-39413, I implemented os.unsetenv() on Windows using 
SetEnvironmentVariable(), but Eryk reported that SetEnvironmentVariable() does 
not update the CRT API (_environ, _wenviron, getenv, etc.). So I reverted my 
change. See bpo-39413 for the details.


Eryk:
> Windows ucrt copies the buffer that's passed to _[w]putenv.

Thank you for checking manually. I pushed commit 
0852c7dd52ac42e7843ddfef44571494e4c86070 to avoid putenv_dict on Windows.

--

___
Python tracker 

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



[issue39406] Implement os.putenv() with setenv() if available

2020-01-22 Thread STINNER Victor


STINNER Victor  added the comment:

The initial issue has been fixed, so I close the issue. Big thanks to Eryk Sun 
for your great help, thanks also Serhiy Storchaka.

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



[issue39366] Remove deprecated nntplib method

2020-01-22 Thread Berker Peksag


Berker Peksag  added the comment:

Thanks for the PR! I'm glad these previously deprecated functions are now gone.

--
components: +Library (Lib)
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> enhancement

___
Python tracker 

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



[issue39395] The os module should unset() environment variable at exit

2020-01-22 Thread STINNER Victor


STINNER Victor  added the comment:

I closed bpo-39406: os.putenv() is now implemented with setenv() if available. 
The internal putenv_dict is no longer used on Windows and if setenv() is 
available.

Now only non-Windows platforms without setenv() are affected by this issue.

--

___
Python tracker 

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



[issue39425] list.count performance regression

2020-01-22 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17516
pull_request: https://github.com/python/cpython/pull/18130

___
Python tracker 

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



[issue39427] python -X options are not documented in the CLI --help

2020-01-22 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

When running python --help there is no documentation on the -X opt options 
available. It just says:

-X opt : set implementation-specific option

without what 'opt' can be.

--
assignee: pablogsal
components: Interpreter Core
messages: 360516
nosy: pablogsal, vstinner
priority: normal
severity: normal
status: open
title: python -X options are not documented in the CLI --help
versions: 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



[issue39427] python -X options are not documented in the CLI --help

2020-01-22 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue39353] Deprecate the binhex module, binhex4 and hexbin4 standards

2020-01-22 Thread Martin Panter


Martin Panter  added the comment:

Is there a recommended replacement for calculating CRC-CCITT? Do it yourself in 
Python code, or use a particular external module?

--
nosy: +martin.panter

___
Python tracker 

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



[issue39353] Deprecate the binhex module, binhex4 and hexbin4 standards

2020-01-22 Thread STINNER Victor


STINNER Victor  added the comment:

> Is there a recommended replacement for calculating CRC-CCITT? Do it yourself 
> in Python code, or use a particular external module?

What is your use case?

--

___
Python tracker 

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



[issue39353] Deprecate the binhex module, binhex4 and hexbin4 standards

2020-01-22 Thread Martin Panter


Martin Panter  added the comment:

Building and verifying the checksum in "RTA protocol" that uses this: 
.
 But I understand CRC-CCITT is one of the two popular 16-bit CRC polynomials, 
used in many other places, according to 
.

--

___
Python tracker 

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



[issue35182] Popen.communicate() breaks when child closes its side of pipe but not exits

2020-01-22 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset d3ae95e1e945ed20297e1c38ba43a18b7a868ab6 by Gregory P. Smith 
(Alex Rebert) in branch 'master':
bpo-35182: fix communicate() crash after child closes its pipes (GH-17020) 
(GH-18117)
https://github.com/python/cpython/commit/d3ae95e1e945ed20297e1c38ba43a18b7a868ab6


--
nosy: +gregory.p.smith

___
Python tracker 

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



  1   2   >