[issue39379] sys.path[0] is already absolute path

2020-01-17 Thread Ken Sato

New submission from Ken Sato :

In the "What’s New In Python 3.9" (Doc/whatsnew/3.9.rst), it says

> Python now gets the absolute path of the script filename specified on the 
> command line (ex: python3 script.py): the __file__ attribute of the __main__ 
> module and sys.path[0] become an absolute path, rather than a relative path.

However, I believe sys.path[0] is already absolute path since the previous 
versions. We can probably remove "and sys.path[0]" from the phrase to avoid 
possible confusions.

--
assignee: docs@python
components: Documentation
messages: 360239
nosy: docs@python, ksato9700
priority: normal
severity: normal
status: open
title: sys.path[0] is already absolute path
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



[issue39372] The header files in Include/ have many declarations with no definition

2020-01-17 Thread Zackery Spytz


Zackery Spytz  added the comment:

The removal of PyNoArgsFunction is the subject of bpo-18091.

--
nosy: +ZackerySpytz

___
Python tracker 

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



[issue38848] compileall fails when the platform lacks a functional sem_open()

2020-01-17 Thread Zackery Spytz


Change by Zackery Spytz :


--
nosy: +ZackerySpytz

___
Python tracker 

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



[issue38848] compileall fails when the platform lacks a functional sem_open()

2020-01-17 Thread Zackery Spytz


Change by Zackery Spytz :


--
pull_requests: +17442
pull_request: https://github.com/python/cpython/pull/18047

___
Python tracker 

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



[issue39173] _AttributeHolder of argparse should support the sort function or not?

2020-01-17 Thread hai shi


hai shi  added the comment:

paul said in issue 39058: `Anyways removing the sort makes sense, and the 
proposed change phrase "in the order attributes were added" is sufficiently 
general.`

I agree paul's opinion now. The functionality meets users' needs now, so we 
don't need spend much time in it;)

--

___
Python tracker 

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



[issue39378] partial of PickleState struct should be traversed.

2020-01-17 Thread hai shi


Change by hai shi :


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

___
Python tracker 

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



[issue39378] partial of PickleState struct should be traversed.

2020-01-17 Thread hai shi


New submission from hai shi :

As subject, looks partial of PickleState struct should be traversed.

--
components: Extension Modules
messages: 360236
nosy: shihai1991
priority: normal
severity: normal
status: open
title: partial of PickleState struct should be traversed.
type: enhancement
versions: Python 3.9

___
Python tracker 

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



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

2020-01-17 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

This is a followup of issue33461. The warning says about removal of the 
encoding parameter in 3.9 . It's already ignored since 3.1 hence I assume this 
should be raising a TypeError in 3.9 removing the deprecation warning. I am 
finding some projects using the encoding parameter though it has no effect. 
Since Python 3.9 has alpha 3 to be released it will be good to fix the 
deprecation in the early stage of release cycle.

--
components: Library (Lib)
messages: 360235
nosy: inada.naoki, serhiy.storchaka, vstinner, xtreak
priority: normal
severity: normal
status: open
title: json.loads encoding parameter deprecation removal in Python 3.9
type: behavior
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



[issue39197] argparse: title and description for mutually exclusive arg groups

2020-01-17 Thread paul j3


paul j3  added the comment:

https://bugs.python.org/issue9694

is the original issue about the titles of the base argument groups.

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



[issue39173] _AttributeHolder of argparse should support the sort function or not?

2020-01-17 Thread paul j3


paul j3  added the comment:

I don't think the SO question is relevant.  It's about changing the order of 
Actions in the Help and/or usage.

Here it's a question of whether to sort the  `argparse.Namespace` display.  I 
think it's been adequately discussed in the recent bug/issues such as 39058.

--
nosy: +paul.j3

___
Python tracker 

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



[issue39197] argparse: title and description for mutually exclusive arg groups

2020-01-17 Thread paul j3


paul j3  added the comment:

A mutually_exclusive_group is not an argument_group.  It affects parsing and 
the usage, but does nothing in the help lines.

A mutually_exclusive_group may be nested in an argument_group if you want 
another group title.  

 g1 = parser.add_argument_group('My Required Group')
 g2 = g1.add_mutually_exclusive_group()

Groups are not really designed for nesting, but this is one case the nesting 
works and is useful.  Nesting, to the extent it works, is simple a consequence 
of inheritance from the _Argument_Container class.

Changing the title of the default action group is always an option, 
mutually_exclusive or not.  Other bug/issues have suggest changing that title 
at creation time, or giving the user a choice (maybe even defining 3 default 
groups).  But for now we recommend creating your own argument group(s) if you 
don't like the titles of the default one(s).

So no, I don't think anything should be changed simply because a 
mutually_exclusive group is marked as required.

--
nosy: +paul.j3

___
Python tracker 

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



[issue39374] Key in sort -> Callable Object instead of function

2020-01-17 Thread Carlos Segura González

Carlos Segura González  added the comment:

The thing is that even in the "Language Reference" is not correct. In 
"https://docs.python.org/3/library/functions.html#sorted; it is stated "key 
specifies a function of one argument that is used to extract a comparison 
key..."

I think that it is better to use the term callable object. In the case of the 
HOW-TO, maybe it would be good to clarify that a function is an example of a 
callable object or include a reference or something like that.

--

___
Python tracker 

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



[issue39374] Key in sort -> Callable Object instead of function

2020-01-17 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +rhettinger

___
Python tracker 

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



[issue39331] 2to3 mishandles indented imports

2020-01-17 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Thank you for the report.  This is a duplicate of #38681.

--
nosy: +cheryl.sabella
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> 2to3 Conversion Result using BlankLine() can be Syntactically 
Incorrect

___
Python tracker 

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



[issue39372] The header files in Include/ have many declarations with no definition

2020-01-17 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue39372] The header files in Include/ have many declarations with no definition

2020-01-17 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset cd7db76a636c218b2d81d3526eb435cfae61f212 by Pablo Galindo in 
branch 'master':
bpo-39372: Clean header files of declared interfaces with no implementations 
(GH-18037)
https://github.com/python/cpython/commit/cd7db76a636c218b2d81d3526eb435cfae61f212


--

___
Python tracker 

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



[issue39374] Key in sort -> Callable Object instead of function

2020-01-17 Thread Vedran Čačić

Vedran Čačić  added the comment:

I think that "HOW TO"s are fundamentally different from the "regular" 
documentation, in that they focus on explaining only the usual use cases and 
valuing simple explanations over the correct ones. Of course this _can_ be 
fixed, but I don't think that it must be done.

--
nosy: +veky

___
Python tracker 

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



[issue39373] new world

2020-01-17 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

Please include a description of the issue you are facing and how it's a CPython 
bug. With an empty report this would be closed.

--
nosy: +xtreak

___
Python tracker 

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



[issue39283] Add ability to inherit unittest arguement parser

2020-01-17 Thread paul j3


paul j3  added the comment:

The issue of testing a script that uses argparse has come up on StackOverFlow a 
number of times.  

As noted the unittesting framework(s) often use their own parsers (not 
necessarily argparse).  That means they are looking at the sys.argv 
commandline.  It is difficult then to provide arguments that apply both to the 
framework, and your own script.  If you try to your own options, the unittest 
parser will complain about unrecognized arguments.

As a first step, your parser should only run when used as a script, not when 
imported (by the unittester).  In other words, only call `parse_args` in the 
'if __name__' block.

If you do need to do unittesting of your parser, there are several 
monkey-patching options:

use 'parser.parse_args(argv)' calls, where 'argv' can be None if used as 
script, and a custom list when being tested.  Some will modify the sys.argv 
during testing.  The test_argparse.py unittest file tests both ways.

testing parser output may also require patching.  Help and errors are sent 
to sys.stdout or sys.stderr.  test_argparse.py uses an ArgumentParser subclass 
that redefines the error() and exit() methods, and redirects stdout/err.

--
nosy: +paul.j3

___
Python tracker 

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



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

2020-01-17 Thread Eric Snow


Eric Snow  added the comment:

+1

This has impact on subinterpreters once they stop sharing the GIL.  (It's 
already on my list of global resources that need better protection.)

--
nosy: +eric.snow

___
Python tracker 

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



[issue36078] argparse: positional with type=int, default=SUPPRESS raise ValueError

2020-01-17 Thread paul j3


paul j3  added the comment:

This is a complicated issue that needs a lot of thought and testing before we 
make any changes.

While all Actions have the 'required' attribute, the programmer can only set it 
for optionals.  _get_positional_kwargs() will raise an error if the programmer 
tries to set it for a positional.  For a positional its value is determined by 
the nargs value.

The distinction between positionals and optionals occurs through out argparse, 
so we shouldn't put much effort (if any) into making their handling more 
uniform.  (The fundamental distinction between the two is whether the 
action.option_strings list is empty or not.)

A fundamental difference in parsing is that an optional's Action is called only 
if the flag is used.  A positional's Action is always called.   

_parse_known_args starts with a list of positionals

positionals = self._get_positional_actions()

The nested consume_positionals function removes actions from this list.

Earlier versions raised an error at the end of parsing if this list was not 
empty.  In the current version that's been replace by the 'required_actions' 
test (which tests both positionals and optionals).  It was this change over 
that resulted in the bug/feature that subparsers (a positionals Action) are no 
longer required (by default).

Positionals with nargs='?' and '*' pose an extra challenge.  They are, in a 
sense, no longer 'required'.  But they will always be 'seen' because their 
nargs is satisfied by an empty list of values.  But that would overwrite any 
'default' in the Namespace.  So there's the added step in _get_values of 
(re)inserting the action.default.  And it's the handling of that 'default' that 
gives rise to the current issue.

These two positionals can also be used in a mutually_exclusive_group.  To 
handle that 'take_action' has to maintain both the 'seen_actions' set and the  
'seen_non_default_actions' set.

--

___
Python tracker 

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



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

2020-01-17 Thread Gregory P. Smith


New submission from Gregory P. Smith :

For more context, see https://bugs.python.org/issue39375 which seeks to 
document the existing caveats.

POSIX lacks any APIs to access the process global environment in a thread safe 
manner.  Given this, we could _consider_ preventing os.putenv() and 
os.environ[x] = y assignment from actually modifying the process global 
environment.  They'd save their changes in our local os.environ underlying 
dict, set a flag that it was modified, but not modify the global.

This would be a visible behavior change and break _some_ class of code. :/

Our stdlib codepaths that launch a new process on POSIX could be modified to to 
always pass our a newly constructed envp from os.environ to exec/spawn APIs.  
The os.system() API would need to stop using the POSIX system() API call in 
order for that to work.

Downside API breakage: Extension module modifications to the environment would 
not be picked up by Python interpreter launched subprocesses.  How much of a 
problem would that be in practice?

We may decide to close this as infeasible and just stick with the documentation 
of the sorry state of POSIX and not attempt to offer any safe 
non-crash-possible workarounds.

--
components: Interpreter Core
messages: 360222
nosy: gregory.p.smith
priority: normal
severity: normal
stage: needs patch
status: open
title: Avoid modifying the process global environment (not thread safe)
type: crash
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



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

2020-01-17 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

https://bugs.python.org/issue39376 tracks possible interpreter behavior changes.

--

___
Python tracker 

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



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

2020-01-17 Thread Gregory P. Smith


New submission from Gregory P. Smith :

The underlying API calls made by os.putenv() and os.environ[name] = value 
syntax are not thread safe on POSIX systems.  POSIX _does not have_ any thread 
safe way to access the process global environment.

In a pure Python program, the GIL prevents this from being an issue.  But when 
embedded in a C/C++ program or using extension modules that launch their own 
threads from C, those threads could also make the invalid assumption that they 
can safely _read_ the environment.  Which is a race condition when a Python 
thread is doing a putenv() at the same time.

We should document the danger.

CPython's os module snapshots a copy of the environment into a dict at import 
time (during CPython startup).  But os.environ[] assignment and os.putenv() 
modify the actual process global environment in addition to updating this dict. 
 (If an embedded interpreter is launched from a process with other threads 
already running, even that initial environment reading could be unsafe if the 
larger application has a thread that wrongly assumes it has exclusive 
environment access)

For people modifying os.environ so that the change is visible to child 
processes, we can recommend using the env= parameter on subprocess API calls to 
supply a new environment.

A broader issue of should we be modifying the process global environment state 
at all from os.putenv() and os.environ[] assignment still exists.  I'll track 
that in another issue (to be opened).

--
assignee: docs@python
components: Documentation
messages: 360221
nosy: docs@python, gregory.p.smith
priority: normal
severity: normal
status: open
title: Document os.environ[x] = y and os.putenv() as thread unsafe
versions: Python 2.7, 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



[issue39293] Windows 10 64-bit needs reboot after install

2020-01-17 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
title: Windows 10 64-bit needs reboot -> Windows 10 64-bit needs reboot after 
install

___
Python tracker 

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



[issue39374] Key in sort -> Callable Object instead of function

2020-01-17 Thread Anthony Flury


Anthony Flury  added the comment:

I will submit a documentation only fix for this in the next day or so.

--
nosy: +anthony-flury

___
Python tracker 

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



[issue39374] Key in sort -> Callable Object instead of function

2020-01-17 Thread Carlos Segura González

Change by Carlos Segura González :


--
type:  -> enhancement

___
Python tracker 

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



[issue39374] Key in sort -> Callable Object instead of function

2020-01-17 Thread Carlos Segura González

New submission from Carlos Segura González :

In the Documentation, the "Sorting HOW TO" 
(https://docs.python.org/3/howto/sorting.html) states that "have a key 
parameter to specify a function to be called". However, it might be other 
callable objects. In fact, some of the examples given in the documentation are 
not with functions.

I suggest: "have a key parameter to specify a callable object that is called..."

--
assignee: docs@python
components: Documentation
messages: 360219
nosy: Carlos Segura González, docs@python
priority: normal
severity: normal
status: open
title: Key in sort -> Callable Object instead of function
versions: 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



[issue39305] Merge nntplib._NNTPBase and nntplib.NNTP

2020-01-17 Thread Luciana


Luciana  added the comment:

I just uploaded the PR, please take a look when you have a chance :)

I did my best trying to come up with a good code.

--

___
Python tracker 

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



[issue39343] Travis CI: documentation job fails in library/nntplib.rst with random network issue on news.gmane.io

2020-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

It seems like the GMANE server has been fixed.

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



[issue39305] Merge nntplib._NNTPBase and nntplib.NNTP

2020-01-17 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue39298] add BLAKE3 to hashlib

2020-01-17 Thread Jack O'Connor


Jack O'Connor  added the comment:

I plan to bring the C code up to speed with the Rust code this week. As part of 
that, I'll probably remove comments like the one above :) Otherwise, is there 
anything else we can do on our end to help with this?

--

___
Python tracker 

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



[issue39373] new world

2020-01-17 Thread John Haley


Change by John Haley :


--
nosy: John Haley
priority: normal
severity: normal
status: open
title: new world

___
Python tracker 

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



[issue17005] Add a topological sort algorithm

2020-01-17 Thread gaborbernat

gaborbernat  added the comment:

I think the new interface feeds better for usage in both sequential or parallel 
workflows, which means we can use a single UI for both, so  from myself

--
nosy: +gaborbernat

___
Python tracker 

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



[issue39352] Remove the formatter module, deprecated since Python 3.4

2020-01-17 Thread Brett Cannon


Brett Cannon  added the comment:

This is already covered in https://www.python.org/dev/peps/pep-0594/ for 
removal in 3.10, so probably best to help get that PEP accepted first then deal 
with the removal.

--

___
Python tracker 

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



[issue32615] Inconsistent behavior if globals is a dict subclass

2020-01-17 Thread Brett Cannon


Brett Cannon  added the comment:

Paul, your attitude on this issue has unfortunately begun violating the PSF 
Code of Conduct which this issue tracker adheres to. I realize you're 
frustrated that the change you are after is not happening, but that doesn't 
mean you can deride others like you have been.

Pablo tried to ask you nicely to change your tone, but now please consider this 
an official warning that if your communication style does not become more civil 
you will most likely end up with your account suspended. I have also let the 
Conduct WG know about this thread and warning for record-keeping purposes.

--
nosy: +brett.cannon

___
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-17 Thread Eddie Elizondo


Eddie Elizondo  added the comment:

Hey all, I've got a fix for this bug and the CI is green: 
https://github.com/python/cpython/pull/18039

TL;DR: The module state have to be cleared at a later time. I explain in detail 
in the PR.

Also, I didn't add a new test since there was a test that was already checking 
for module states in `io`. I added a short comment on it in the PR as well. 
Otherwise, lmk and I can create a new test for it.

--

___
Python tracker 

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



[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2020-01-17 Thread Eric Snow


Eric Snow  added the comment:

Thanks, Victor!

--

___
Python tracker 

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



[issue37224] test__xxsubinterpreters fails randomly

2020-01-17 Thread Eric Snow


Eric Snow  added the comment:

On Wed, Jan 15, 2020 at 12:20 AM Kyle Stanley  wrote:
> As can be seen from the results above, the interpreter is not even running in 
> the first place before
> it's destroyed, so of course destroy() won't raise an RuntimeError. I think 
> this proves that
> interpreters.destroy() is _not_ where we should be focusing our efforts (at 
> least for now). Instead,
> we should first investigate why it's not even running at this point.

Good catch.

> I suspect the issue _might_ be a race condition within the "_running()" 
> context manager that's
> preventing the interpreter from being ran, but I'll have to do some further 
> investigation.

Sounds good.

> Notably, a rather difficult and hard to explain side effect occurred from 
> adding the new assertion.
> [snip]
> But, I have no explanation for this.

Yeah, that sounds a bit strange.  Keep in mind that there have been
other changes in this part of the runtime code, so this might be
related.  Or I suppose it could be a side effect of calling
is_running() (though that definitely should not have side effects).

> do you think it might be worth adding in the changes I made to 
> DestroyTests.test_still_running above?

Yeah, it's a good sanity check on the assumptions made by the test.
Please do open a PR and request a review from me.

--

___
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-17 Thread Eddie Elizondo


Change by Eddie Elizondo :


--
pull_requests: +17438
pull_request: https://github.com/python/cpython/pull/18039

___
Python tracker 

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



[issue39372] The header files in Include/ have many declarations with no definition

2020-01-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Good catch!

All removals LGTM.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue39370] askopenfilename is missing from the Tkinter filedialog library in 2.7.17

2020-01-17 Thread Ned Deily


Ned Deily  added the comment:

In Python 2, askopenfilename was in the separate tkFileDialog module:

>>> import tkFileDialog
>>> dir(tkFileDialog.askopenfilename)
['__call__',  ...

https://docs.python.org/2/library/tkinter.html?highlight=tkfiledialog#tkinter-modules

"Other modules that provide Tk support include:
[...]
tkFileDialog
Common dialogs to allow the user to specify a file to open or save.
[...]
These have been renamed as well in Python 3; they were all made submodules of 
the new tkinter package."

--
nosy: +ned.deily
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type: crash -> 

___
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-17 Thread Dino Viehland


Dino Viehland  added the comment:

https://github.com/python/cpython/pull/18038 is a partial fix for this.  I 
think it fixes the crash at shutdown, although I'm still seeing a hang on 
master on Linux which is different then earlier versions of Python.  I seem to 
have a really bogus stack trace when I attach to it so I'm not quite certain 
what's going on there.

--

___
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-17 Thread Dino Viehland


Change by Dino Viehland :


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

___
Python tracker 

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



[issue29435] Allow to pass fileobj to is_tarfile

2020-01-17 Thread William Woodruff


William Woodruff  added the comment:

I'll take a stab at this. It looks like `Tarfile.open` takes an optional 
keyword that should make this straightforward.

--
nosy: +yossarian

___
Python tracker 

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



[issue39372] The header files in Include/ have many declarations with no definition

2020-01-17 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue39372] The header files in Include/ have many declarations with no definition

2020-01-17 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

There are many declarations that lack definitions in our header files that 
should be cleaned (linking against those symbols will fail so removing them 
should be safe if I am not missing something).

--
components: Build
messages: 360204
nosy: pablogsal
priority: normal
severity: normal
status: open
title: The header files in Include/ have many declarations with no definition
type: enhancement
versions: Python 3.9

___
Python tracker 

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



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

2020-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

BinHex format: https://en.wikipedia.org/wiki/BinHex

The question here is not only if binhex remains popular, but more generally if 
we want to continue to maintain it forever. Each module has a cost on the 
overall Python maintenance burden.

--

___
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-17 Thread STINNER Victor


STINNER Victor  added the comment:

Serhiy Storchaka asked:
https://github.com/python/cpython/pull/18025#issuecomment-575645748

"""
What is a benefit of deprecating it?

This module is a high-level interface to several functions in the binascii 
module. This is all macOS specific stuff, so you need to ask macOS experts. If 
this encoding no longer used in macOS, its support can be removed, with 
deprecating first. If there are no plans to remove, there is no reason to 
deprecate.
"""

The intent is to reduce the size of the standard library to reduce the 
maintenance burden of Python in general. The final goal is to remove the 
module. But that's a first step to check if there is still any user around. We 
should deprecate it for at least one cycle.

I understood that binhex4 and hexbin4 standards were used on Mac OS 9 but are 
no longer used on macOS, nor used anywhere else. See my first message.

Mac OS 9 is really outdated in 2020 and will likely be completly dead when 
Python 3.10 will be released (first Python release when we will be able to 
remove the module).

About the removal: I would like first write a PEP to propose a process to move 
old or unmaintained modules from the stdlib to PyPI. The "removal" would mean 
"move to PyPI" (but yeah, technically it would still be removed from the 
stdlib).

But I don't want to open a discuss on this hypothetical PEP *here* (I didn't 
write it yet :-D).

--

___
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-17 Thread STINNER Victor


STINNER Victor  added the comment:

> If deprecate the binhex module, we perhaps should deprecate also 
> binascii.b2a_hqx(), binascii.a2b_hqx(), binascii.rlecode_hqx(), 
> binascii.rledecode_hqx() and binascii.crc_hqx().

Ok, let's do that. I updated the issue title and my PR.

--

___
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-17 Thread STINNER Victor


Change by STINNER Victor :


--
title: Deprecate the binhex module -> Deprecate the binhex module, binhex4 and 
hexbin4 standards

___
Python tracker 

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



[issue39371] http.client.HTTPResponse raises IncompleteRead on chunked encoding

2020-01-17 Thread Arden


Arden  added the comment:

Pythons 3.5-3.7 also have
  self.chunk_left = 0
in  _readinto_chunked

I think it's bug but I didn't check it thoroughly

--

___
Python tracker 

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



[issue39308] Literal[True] prints as Literal[1] in some cases

2020-01-17 Thread Guido van Rossum


Change by Guido van Rossum :


--
resolution:  -> wont fix
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



[issue39371] http.client.HTTPResponse raises IncompleteRead on chunked encoding

2020-01-17 Thread Arden


New submission from Arden :

http.client.HTTPResponse._readinto_chunked has two problems in python 3.8 - 3.9.

1. _safe_readinto assumes that self.fp.readinto(b) will read exactly len(b) 
bytes. This is not always true, especially in case of SSL traffic. But 
_safe_readinto raises IncompleteRead if less len(b) bytes was read.

So, _safe_readinto should be removed and substituted with self.fp.readinto

2. _readinto_chunked may lose chunked block boundary because of this line:
  self.chunk_left = 0
it should be changed to
  self.chunk_left = chunk_left - n
in order to self._get_chunk_left() be able to find real chunk boundary

Corrected function looks like this:
def _readinto_chunked(self, b):
assert self.chunked != _UNKNOWN
total_bytes = 0
mvb = memoryview(b)
try:
while True:
chunk_left = self._get_chunk_left()
if chunk_left is None:
return total_bytes

if len(mvb) <= chunk_left:
n = self.fp.readinto(mvb)
self.chunk_left = chunk_left - n
return total_bytes + n

temp_mvb = mvb[:chunk_left]
n = self.fp.readinto(temp_mvb)
mvb = mvb[n:]
total_bytes += n
self.chunk_left = chunk_left - n

except IncompleteRead:
raise IncompleteRead(bytes(b[0:total_bytes]))

--
components: Library (Lib)
messages: 360199
nosy: Arden
priority: normal
severity: normal
status: open
title: http.client.HTTPResponse raises IncompleteRead on chunked encoding
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



[issue27540] msvcrt.ungetwch() calls _ungetch()

2020-01-17 Thread Zachary Ware


Zachary Ware  added the comment:

If this isn't an issue in Python 3, I agree.

--

___
Python tracker 

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



[issue27657] urlparse fails if the path is numeric

2020-01-17 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue39366] Remove deprecated nntplib method

2020-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

>>> a.description('gmane.comp.python.committers')
'CPython Committers (non-public) (Moderated)'
>>> a.descriptions('gmane.comp.python.committers')
('215 Newsgroup descriptions in form "group description"', 
{'gmane.comp.python.committers': 'CPython Committers (non-public) (Moderated)'})

Well, both results contain the same important string: 'CPython Committers 
(non-public) (Moderated)'. So I think that it's ok to drop xgtitle() as well.

--

___
Python tracker 

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



[issue27657] urlparse fails if the path is numeric

2020-01-17 Thread Chris Dent


Chris Dent  added the comment:

Just to add to the list of places this is causing a regression. This has broken 
the target host determination routines in gabbi: 
https://github.com/cdent/gabbi/issues/277

While the original fix may have been strictly correct in some ways, it results 
in a terrible UX, and as several others have noted violated backwards 
compatibility.

--
nosy: +Chris Dent

___
Python tracker 

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



[issue39368] A matrix (list of lists) behaves differently, depending how it is created

2020-01-17 Thread Jaap Woldringh

Jaap Woldringh  added the comment:

Op 17-01-2020 om 14:03 schreef Karthikeyan Singaravelan:
> Karthikeyan Singaravelan  added the comment:
>
> You're referencing to the same list 3 times in B. So modifying it once means 
> all the elements referring to same object reflect the change. Make a copy of 
> the list during append to ensure modification of one doesn't affect other. 
> This is not a python bug.
>
> --
> nosy: +xtreak
>
> ___
> Python tracker 
> 
> ___

Ah, I see! Thank you for pointing this out to me! I have been pondering 
this for days on end on what was happening here.

This behaviour of Python is very frustrating, and even if "it is not a 
bug" (I knew it!) it's very nasty, and shouldn't be. Your suggestion of 
making a copy of the list during the append saves my day! And Python itself!

I was creating a very simple program for encrypting a sentence using a 
square matrix, and expected a one hour job at most. It became days, and 
I finally created a very simple method, without a rxk matrix itself, but 
using the idea!

So, if possible, please, improve Python so that this feature doesn't 
cause these unnecessary problems. Meanwhile I retract my bug report!

To my opinion this feature of Python, having aparently same objects 
refer to the same addresses in memory, was useful in times long ago when 
memory was expensive. But now this feature is not feature at all. To my 
opinion :)

Gtsori menf egr

Jaap Woldringh

--
Added file: https://bugs.python.org/file48850/code.py

___
Python tracker 

___### een nieuwe wijze van coderen met behulp
### van een denkbeeldige vierkante matrix
###
def codeertekst(tekst):
lengte = len(tekst)
# bepalen dimensie vierkante matrix
j=1
while j*j___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39370] askopenfilename is missing from the Tkinter filedialog library in 2.7.17

2020-01-17 Thread Dreas Nielsen


New submission from Dreas Nielsen :

In Python 2.7.17 on Linux, the code:

import tkinter.filedialog as tkfiledialog
dir(tkfiledialog.askopenfilename)

results in:

AttributeError: 'module' object has no attribute 'askopenfilename'

Any attempt to use 'askopenfilename' has the same result, of course.

--
components: Tkinter
messages: 360194
nosy: rdnielsen
priority: normal
severity: normal
status: open
title: askopenfilename is missing from the Tkinter filedialog library in 2.7.17
type: crash
versions: Python 2.7

___
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

2020-01-17 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +macOS
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue39356] zipfile suprising "except DeprecationWarning:" block

2020-01-17 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



[issue39356] zipfile suprising "except DeprecationWarning:" block

2020-01-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 1d3b0aaa54c56282c0a3e7fc396e5b1de8b1974e by Victor Stinner in 
branch 'master':
bpo-39356, zipfile: Remove code handling DeprecationWarning (GH-18027)
https://github.com/python/cpython/commit/1d3b0aaa54c56282c0a3e7fc396e5b1de8b1974e


--

___
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-17 Thread Dong-hee Na


Dong-hee Na  added the comment:

> Does 
> https://docs.python.org/dev/library/nntplib.html#nntplib.NNTP.description 
> give the same result?

Not exactly same but descriptions give a similar result.

>>> import nntplib
>>> a = nntplib.NNTP('news.gmane.io')
>>> a.description('gmane.comp.python.committers')
'CPython Committers (non-public) (Moderated)'
>>> a.descriptions('gmane.comp.python.committers')
('215 Newsgroup descriptions in form "group description"', 
{'gmane.comp.python.committers': 'CPython Committers (non-public) (Moderated)'})
>>> a.xgtitle('gmane.comp.python.committers')
:1: DeprecationWarning: The XGTITLE extension is not actively used, use 
descriptions() instead
('282 Descriptions in form "group description"', 
[('gmane.comp.python.committers', 'CPython Committers (non-public) 
(Moderated)')])

--

___
Python tracker 

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



[issue39369] Doc: Update mmap readline method documentation

2020-01-17 Thread Wellington PF


New submission from Wellington PF :

Update mmap readline method description. The fact that the readline method does 
update the file position should not be ignored since this might give the 
impression for the programmer that it doesn't update it.

--
assignee: docs@python
components: Documentation
messages: 360191
nosy: docs@python, wellpardim
priority: normal
pull_requests: 17435
severity: normal
status: open
title: Doc: Update mmap readline method documentation
type: enhancement

___
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-17 Thread STINNER Victor


STINNER Victor  added the comment:

>>> a.xgtitle('gmane.comp.python.committers')
('282 Descriptions in form "group description"', 
[('gmane.comp.python.committers', 'CPython Committers (non-public) 
(Moderated)')])

Does https://docs.python.org/dev/library/nntplib.html#nntplib.NNTP.description 
give the same result?

--

___
Python tracker 

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



[issue39165] Completeness and symmetry in RE, avoid `findall(...)[0]`

2020-01-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Most of examples do not test whether findall() returns an empty list. So there 
is no significant difference with using search() -- just different type of 
exception if fails (IndexError, TypeError or AttributeError). Since most 
examples do not handle errors, this will only affect a traceback if you use the 
script improperly.

If it is important to you, you can write (re.search(...) or [])[0] and get the 
same IndexError.

--

___
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-17 Thread Dong-hee Na


Dong-hee Na  added the comment:

Looks like xgtitle is supported but xpath is not.

>>> a.xgtitle('gmane.comp.python.committers')
('282 Descriptions in form "group description"', 
[('gmane.comp.python.committers', 'CPython Committers (non-public) 
(Moderated)')])
>>> a.xpath(message_id)
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/nntplib.py", 
line 865, in xpath
resp = self._shortcmd('XPATH {0}'.format(id))
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/nntplib.py", 
line 513, in _shortcmd
return self._getresp()
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/nntplib.py", 
line 458, in _getresp
raise NNTPPermanentError(resp)
nntplib.NNTPPermanentError: 500 What?

--

___
Python tracker 

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



[issue39165] Completeness and symmetry in RE, avoid `findall(...)[0]`

2020-01-17 Thread Juancarlo Añez

Juancarlo Añez  added the comment:

The analysis done by Terry bypasses the fact that `search(...)` returns `None` 
when there is no match, so indexing or calling methods in its result is not 
safe code. 

`findall()` returns an empty list when there is no match.

`findalliter()` returns an empty iterator when there is no match.

`findfirst()` may return a `default` value when there is no match.

If `search()` is proposed to replace `findall()[0]`, then the idiom has to be 
(depending on the case):

m[0] if (m := re.search(...)) else '0'
m.groups() if (m := re.search(...)) else '0'

In contrast, `findfirst()` returns a value that is the same as `findall()` when 
there is a match, or a `default` if there is no match.

m[0] if (m := re.findall(...)) else '0'

Compare with:

findfirst(..., default='0')

--

___
Python tracker 

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



[issue39165] Completeness and symmetry in RE, avoid `findall(...)[0]`

2020-01-17 Thread Juancarlo Añez

Juancarlo Añez  added the comment:

The bottom problem, as I see it, is that, historically, `re.search()` returns 
`None` when there is no match, instead of returning a `Match` object that is 
consistent with "no match" (evaluates to `False`, etc.)

The above seems too difficult to repair as so much existing code relies on 
those semantics (`if match is None` is the risky bit). 

Hence, `findall()`, `findalliter()`, and `findfirst()`.

--

___
Python tracker 

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



[issue39368] A matrix (list of lists) behaves differently, depending how it is created

2020-01-17 Thread Ezio Melotti


Ezio Melotti  added the comment:

See also 
https://docs.python.org/3/faq/programming.html#why-did-changing-list-y-also-change-list-x

You can use the builtin function id() to see the id of the lists, and verify 
whether they refer to the same object or not.

--
nosy: +ezio.melotti
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



[issue39368] A matrix (list of lists) behaves differently, depending how it is created

2020-01-17 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

You're referencing to the same list 3 times in B. So modifying it once means 
all the elements referring to same object reflect the change. Make a copy of 
the list during append to ensure modification of one doesn't affect other. This 
is not a python bug.

--
nosy: +xtreak

___
Python tracker 

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



[issue39357] bz2: Remove deprecated buffering parameter of bz2.BZ2File

2020-01-17 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the fix Victor :)

--

___
Python tracker 

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



[issue39368] A matrix (list of lists) behaves differently, depending how it is created

2020-01-17 Thread Jaap Woldringh

New submission from Jaap Woldringh :

Python used:
Python 3.6.9 (default, Nov  7 2019, 10:44:02) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
In Ubuntu 18.04.3

But in any other version of Python3, and Python2,  that I tried, the behaviour 
of a (square) matrix depends on how it is created; as I can demonstrate in a 
test program matrix_experiment.py that is attached to this report.

1. it behaves as expected when created by entering all it’s elements like so:
A = [[ 1,2,3],[1,2,3],[1,2,3]]

2. If it is created by appending predefined rows, it behaves as if all rows are 
the same as the last row:
row = [1,2,3]
B=[]
for i in range(3):
B.appends(row)

The result matrix is the same as A:   [[1, 2, 3], [1, 2, 3], [1, 2, 3]]

Both results are equal:

print(A==B) gives True.

But when using B the result is disastrous as the attached matrix_experiment.py
program shows.

I consider this a very serious bug, and first filed it at Ubuntu’s Launchpad, 
but I don't find it there.
So now I file this again, at Python.org itself, using my new account.

--
components: Tests
files: matrix_experiment.py
messages: 360182
nosy: jjhwoldringh
priority: normal
severity: normal
status: open
title: A matrix (list of lists) behaves differently, depending how it is created
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file48849/matrix_experiment.py

___
Python tracker 

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



[issue39357] bz2: Remove deprecated buffering parameter of bz2.BZ2File

2020-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Karthikeyan, I forgot about the docstring.

--

___
Python tracker 

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



[issue39357] bz2: Remove deprecated buffering parameter of bz2.BZ2File

2020-01-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 10fd6b2b9f0aeb8f5a0ce4cb4b9f21f942d39a71 by Victor Stinner in 
branch 'master':
bpo-39357: Update bz2 docstring: remove buffering (GH-18036)
https://github.com/python/cpython/commit/10fd6b2b9f0aeb8f5a0ce4cb4b9f21f942d39a71


--

___
Python tracker 

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



[issue39367] readline module core dumps Python 3.8.1 when calling exit()

2020-01-17 Thread Horace Stoica


Horace Stoica  added the comment:

Tried dnf install python38 and it works. Thank you!

--

___
Python tracker 

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



[issue39367] readline module core dumps Python 3.8.1 when calling exit()

2020-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

> The reason I am building from source is that Fedora 30 provides Python 3.7.3 
> and I wanted to try out the new features (like the walrus operator) that were 
> introduced in version 3.8.

Did you try "dnf install python38"? It's available on Fedora 30. FYI I'm part 
of the package maintainers of Python packages on Fedora and RHEL ;-)

--

___
Python tracker 

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



[issue32615] Inconsistent behavior if globals is a dict subclass

2020-01-17 Thread Paul Sokolovsky


Paul Sokolovsky  added the comment:

> We may be possible to replace bytecode from `STORE_GLOBAL _cnt; LOAD_GLOBAL 
> _cnt` into `DUP_TOP; STORE_GLOBAL _cnt`.

Sounds good, and that's why I personally care about the "STORE" case, and the 
patch I submit touches only it, which would affect only cases when explicit 
"global var" declarations are used, which aren't frequent. I definitely would 
be too shy to submit a patch for more LOAD_* cases, though I may image why 
people may want that still.

--

___
Python tracker 

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



[issue39367] readline module core dumps Python 3.8.1 when calling exit()

2020-01-17 Thread Horace Stoica


Horace Stoica  added the comment:

A big "thank you" to everyone, I installed readline-develop and rebuilt from 
source, and now the problem is fixed.

The reason I am building from source is that Fedora 30 provides Python 3.7.3 
and I wanted to try out the new features (like the walrus operator) that were 
introduced in version 3.8.

I hope to get to the point of contributing to Python itself, for now I am 
looking mainly at extending Python with C++ and embedding Python in C++ 
applications. 

Thanks again, 
Horace

--

___
Python tracker 

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



[issue27379] SocketType changed in Python 3

2020-01-17 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
versions: +Python 3.8, Python 3.9 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue32615] Inconsistent behavior if globals is a dict subclass

2020-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

As explained multiple times, this feature request is rejected. I close the 
issue.

Paul: Your behavior is not appropriate and violates the Python code of conduct. 
You have already been warned by Pablo.

--
resolution:  -> rejected
stage: test needed -> 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



[issue39367] readline module core dumps Python 3.8.1 when calling exit()

2020-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

Oh right, Ammar is right, you miss a dependency. Try maybe:

sudo dnf install -y dnf-plugins-core
sudo dnf builddep -y python3

https://cpython-core-tutorial.readthedocs.io/en/latest/build_cpython_linux.html

... but why are you building Python from source? Fedora provides python3.8 ;-) 
At least, on Fedora 31, Python 3.8 and 3.9 are packaged ;-)

If you built it to contribute to Python, that's great!

--

___
Python tracker 

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



[issue39357] bz2: Remove deprecated buffering parameter of bz2.BZ2File

2020-01-17 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17434
pull_request: https://github.com/python/cpython/pull/18036

___
Python tracker 

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



[issue39367] readline module core dumps Python 3.8.1 when calling exit()

2020-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

I'm able to reproduce the issue on Fedora 31, but only if the 3rd party 
readline module is loaded, instead of the stdlib "readline" module.

The problem is that https://pypi.org/project/readline/ misuses the Python 
memory allocator API. The GIL must be held to call PyMem_Malloc(). This project 
should be modified to use PyMem_RawMalloc().

https://docs.python.org/dev/c-api/memory.html#raw-memory-interface
vs
https://docs.python.org/dev/c-api/memory.html#memory-interface

It's a bug in a 3rd party module, I close the issue.


== packaged Python 3.8 ==

vstinner@apu$ python3.8 -m pip install --user readline

Python still uses the stdlib module by default (sys.path order):

vstinner@apu$ python3.8 
Python 3.8.1 (default, Dec 19 2019, 00:00:00) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import readline
>>> readline


I'm using uninstall just to know the path, but then cancel:

vstinner@apu$ python3.8 -m pip uninstall readline
Uninstalling readline-6.2.4.1:
  Would remove:

/home/vstinner/.local/lib/python3.8/site-packages/readline-6.2.4.1-py3.8.egg-info

/home/vstinner/.local/lib/python3.8/site-packages/readline.cpython-38-x86_64-linux-gnu.so
Proceed (y/n)? n

I reproduce the issue if I force to prefer the 3rd party readline:

vstinner@apu$ PYTHONPATH=/home/vstinner/.local/lib/python3.8/site-packages/ 
python3.8 
Python 3.8.1 (default, Dec 19 2019, 00:00:00) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import readline
munmap_chunk(): invalid pointer
Abandon (core dumped)

== Python 3.9 compiled manually in debug mode ==

(...)
vstinner@apu$ 
PYTHONPATH=/home/vstinner/python/master/env/lib/python3.9/site-packages/ gdb 
-args env/bin/python 
GNU gdb (GDB) Fedora 8.3.50.20190824-26.fc31
(gdb) run

>>> import readline
Fatal Python error: Python memory allocator called without holding the GIL
Python runtime state: initialized

Current thread 0x77c1f740 (most recent call first):


Program received signal SIGABRT, Aborted.
0x77c60625 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: dnf debuginfo-install 
libxcrypt-4.4.10-2.fc31.x86_64 ncurses-libs-6.1-12.20190803.fc31.x86_64
(gdb) where
#0  0x77c60625 in raise () from /lib64/libc.so.6
#1  0x77c498d9 in abort () from /lib64/libc.so.6
#2  0x00560b43 in fatal_error (prefix=0x0, msg=0x6b4c40 "Python memory 
allocator called without holding the GIL", status=-1) at 
Python/pylifecycle.c:2249
#3  0x00560b6f in Py_FatalError (msg=0x6b4c40 "Python memory allocator 
called without holding the GIL") at Python/pylifecycle.c:2259
#4  0x0047d988 in _PyMem_DebugCheckGIL () at Objects/obmalloc.c:2320
#5  0x0047d9a0 in _PyMem_DebugMalloc (ctx=0x7cd950 <_PyMem_Debug+48>, 
nbytes=17) at Objects/obmalloc.c:2328
#6  0x0047b958 in PyMem_Malloc (size=17) at Objects/obmalloc.c:605
#7  0x7fffeaa48dc0 in call_readline (sys_stdin=0x77de67e0 
<_IO_2_1_stdin_>, sys_stdout=0x77de7500 <_IO_2_1_stdout_>, 
prompt=0x7fffeaa9c480 ">>> ")
at Modules/3.x/readline.c:1122
#8  0x0069e8a4 in PyOS_Readline (sys_stdin=0x77de67e0 
<_IO_2_1_stdin_>, sys_stdout=0x77de7500 <_IO_2_1_stdout_>, 
prompt=0x7fffeaa9c480 ">>> ")
at Parser/myreadline.c:358
#9  0x00615155 in tok_nextc (tok=0x988f00) at Parser/tokenizer.c:848
#10 0x00615f7d in tok_get (tok=0x988f00, p_start=0x7fffd118, 
p_end=0x7fffd110) at Parser/tokenizer.c:1128
#11 0x00617876 in PyTokenizer_Get (tok=0x988f00, 
p_start=0x7fffd118, p_end=0x7fffd110) at Parser/tokenizer.c:1774
#12 0x00612862 in parsetok (tok=0x988f00, g=0x7f1ce0 
<_PyParser_Grammar>, start=256, err_ret=0x7fffd280, flags=0x7fffd27c) 
at Parser/parsetok.c:251
#13 0x00612672 in PyParser_ParseFileObject (fp=0x77de67e0 
<_IO_2_1_stdin_>, filename='', enc=0x7fffeab24340 "utf-8", g=0x7f1ce0 
<_PyParser_Grammar>, start=256, 
ps1=0x7fffeaa9c480 ">>> ", ps2=0x7fffeaa9c520 "... ", 
err_ret=0x7fffd280, flags=0x7fffd27c) at Parser/parsetok.c:186
#14 0x00567716 in PyParser_ASTFromFileObject (fp=0x77de67e0 
<_IO_2_1_stdin_>, filename='', enc=0x7fffeab24340 "utf-8", start=256, 
ps1=0x7fffeaa9c480 ">>> ", 
ps2=0x7fffeaa9c520 "... ", flags=0x7fffd470, errcode=0x7fffd314, 
arena=0x7fffeab2d7c0) at Python/pythonrun.c:1387
#15 0x00564fc1 in PyRun_InteractiveOneObjectEx (fp=0x77de67e0 
<_IO_2_1_stdin_>, filename='', flags=0x7fffd470) at 
Python/pythonrun.c:239
#16 0x00564cbd in PyRun_InteractiveLoopFlags (fp=0x77de67e0 
<_IO_2_1_stdin_>, filename_str=0x69f43a "", flags=0x7fffd470) at 
Python/pythonrun.c:121
#17 0x00564b80 in PyRun_AnyFileExFlags (fp=0x77de67e0 
<_IO_2_1_stdin_>, filename=0x69f43a "", closeit=0, flags=0x7fffd470) 
at 

[issue32615] Inconsistent behavior if globals is a dict subclass

2020-01-17 Thread Inada Naoki


Inada Naoki  added the comment:

> Ironically, to let people prototype better, more efficient ways to deal with 
> namespace access, it should be possible to override an object used as a 
> namespace.

You can benchmark your prototype namespace object by regular Python code:

  d["name"]  # LOAD_GLOBAL
  d["name"] = 1  # STORE_GLOBAL

So I don't think no overriding blocks prototyping.


On the other hand, allowing overriding makes future optimizations difficult.  
For example:

```
>>> import dis
>>> def counter():
... global _cnt
... _cnt += 1
... return _cnt
...
>>> dis.dis(counter)
  3   0 LOAD_GLOBAL  0 (_cnt)
  2 LOAD_CONST   1 (1)
  4 INPLACE_ADD
  6 STORE_GLOBAL 0 (_cnt)

  4   8 LOAD_GLOBAL  0 (_cnt)
 10 RETURN_VALUE
```

We may be possible to replace bytecode from `STORE_GLOBAL _cnt; LOAD_GLOBAL 
_cnt` into `DUP_TOP; STORE_GLOBAL _cnt`.

If we guarantee namespace overriding, it's very easy to break the guarantee 
while such optimization.

--

___
Python tracker 

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



[issue39367] readline module core dumps Python 3.8.1 when calling exit()

2020-01-17 Thread Ammar Askar


Ammar Askar  added the comment:

> Installed the readline module as the arrows do not work when running Python 
> interactively.

This is not a suggested way to fix the issue, especially given that the module 
you installed is marked as deprecated: https://pypi.org/project/readline/

> Built Python 3.8.1 from source on Fedora 30:

Instead, when you compile, look for a line like this

Failed to find the necessary bits to build these modules:
...
readline

or

Failed to build these modules:
...
readline

and then scan through the build log to either find the compiler error or you're 
most probably missing a dependency like readline-devel

--
nosy: +ammar2

___
Python tracker 

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



[issue39367] readline module core dumps Python 3.8.1 when calling exit()

2020-01-17 Thread Horace Stoica


New submission from Horace Stoica :

Built Python 3.8.1 from source on Fedora 30:

kernel: 5.1.8-300.fc30.x86_64

Python 3.8.1 (default, Jan 15 2020, 08:49:34)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)] on linux

Installed the readline module as the arrows do not work when running Python 
interactively.

~/local/bin/pip3.8 install readline
Collecting readline
  Using cached 
https://files.pythonhosted.org/packages/f4/01/2cf081af8d880b44939a5f1b446551a7f8d59eae414277fd0c303757ff1b/readline-6.2.4.1.tar.gz

However, after installing readline Python core-dumps on Crtl+D or exit():

>>> exit()
munmap_chunk(): invalid pointer
Aborted (core dumped)

I uninstalled the readline module and now it no longer core dumps.

--
components: Extension Modules
messages: 360170
nosy: fhstoica
priority: normal
severity: normal
status: open
title: readline module core dumps Python 3.8.1 when calling exit()
type: crash
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



[issue39366] Remove deprecated nntplib method

2020-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

I'm not used to the NNTP protocol. Does the news.gmane.io support these 2 
extensions?

--

___
Python tracker 

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



[issue39357] bz2: Remove deprecated buffering parameter of bz2.BZ2File

2020-01-17 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

https://github.com/python/cpython/blob/9baf242fc733ab8a52a0b6201d95c6fdb8251745/Lib/bz2.py#L50
 contains similar reference about buffering parameter deprecation like bz2.rst 
which could also be removed. Thanks.

--
nosy: +xtreak

___
Python tracker 

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



[issue32615] Inconsistent behavior if globals is a dict subclass

2020-01-17 Thread Paul Sokolovsky


Paul Sokolovsky  added the comment:

Absolutely should be able to optimize namespace access. The fact that namespace 
is a dict is an implementation detail, it's still inefficient even with all 
those version counters and inline caches. Ironically, to let people prototype 
better, more efficient ways to deal with namespace access, it should be 
possible to override an object used as a namespace. Thanks for making that much 
more complicated.

--

___
Python tracker 

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



[issue38921] Max Recursion Depth Reached in Logging Library

2020-01-17 Thread yang


yang  added the comment:

You assigned a handler to a variable `formatter`, and then called 
`setFormatter(formatter)`, but `formatter` is in fact a handler. The two 
classes `Formatter` and `Handler` happen to have a same name method `format` 
which is called when logging. So what happend is the logger wants to format 
your logging string, and it calls its handlers' `format` method. And in this 
handler's `format` method, the handler calls its formatter's `format` method, 
which ends to be another handler rather than a real formatter. And you repeated 
it 1000 times, which caused a 1000-level nested recursion.

--
nosy: +fhsxfhsx

___
Python tracker 

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



[issue32615] Inconsistent behavior if globals is a dict subclass

2020-01-17 Thread Inada Naoki


Inada Naoki  added the comment:

This is duplicate of #1402289, which was rejected.

I agree with Victor.  Python should be free to optimize namespace access.

Namespace access is an implementation detail and user should not assume such 
"consistency" here.  It is like this:

  x = 1000
  y = x - 1 + 1
  print(x is y)  # True or False, it's implementation detail.


It seems inconsistent for some people, but there are some areas people 
shouldn't assume consistency.

--
nosy: +inada.naoki

___
Python tracker 

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



[issue39336] Immutable module type can't be used as package in custom loader

2020-01-17 Thread Dong-hee Na


Dong-hee Na  added the comment:

I apologize for the noise caused by the wrong PR connection.

--
nosy: +corona10

___
Python tracker 

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



[issue39336] Immutable module type can't be used as package in custom loader

2020-01-17 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests:  -17433

___
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-17 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue39336] Immutable module type can't be used as package in custom loader

2020-01-17 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests:  -17431

___
Python tracker 

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



[issue39336] Immutable module type can't be used as package in custom loader

2020-01-17 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +17433
pull_request: https://github.com/python/cpython/pull/18035

___
Python tracker 

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



[issue39336] Immutable module type can't be used as package in custom loader

2020-01-17 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +17431
pull_request: https://github.com/python/cpython/pull/18035

___
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-17 Thread Dong-hee Na


New submission from Dong-hee Na :

Remove deprecated methods since Python 3.3.
Moreover nntplib.NNTP.xgtitle has not been exposed through docs.python.org
https://docs.python.org/3/library/nntplib.html

--
assignee: corona10
messages: 360163
nosy: corona10, vstinner
priority: normal
severity: normal
status: open
title: Remove deprecated nntplib 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



  1   2   >