[issue40257] Improve the use of __doc__ in pydoc

2020-04-11 Thread Vedran Čačić

Vedran Čačić  added the comment:

I don't agree with 1. I use that feature a lot, I write a base class which my 
students must subclass to their liking, but they still expect that 
help(TheirClass) will give them the documentation they need.

I agree that in _some_ cases it is not helpful (but even when the base is 
abstract, it might be helpful). How about: we keep the current behavior, but 
make it clear that the docstring applies to a superclass? It might be subtle, 
as just changing the first line of help() output (currently it says "Help on 
class Derived in module ...", change it to "Help on class Base in module ..."), 
or write a longer message such as "Documentation for Derived not found, showing 
the documentation for Base". But just removing it in all cases is really a 
wrong thing to do.

--
nosy: +veky

___
Python tracker 

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



[issue40258] random module does not have type hints

2020-04-11 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue40255] Fixing Copy on Writes from reference counting

2020-04-11 Thread Eddie Elizondo


Eddie Elizondo  added the comment:

> the CPU performance implications of adding a branch instruction to Py_INCREC 
> and Py_DECREF were, unsurprisingly, quite high.

Yeah, makes sense. I guess it really depends on the specific profile of your 
application.

For Instagram this was an overall net positive change and we still have it in 
prod. The amount of page faults from Copy on Writes was so large that reducing 
it resulted in a net CPU win (even with the added branching). And of course, a 
huge reduction in memory usage.


> Microbenchmarks don't tell a good story, the python performance test suite 
> should

Agreed. I only added the Richards benchmark as a reference. I'm hoping someone 
can pick it up and have more concrete numbers on an average Python workload.


> Given that most people's applications don't fork workers, I do not expect to 
> see such an implementation ever become the default.

In any case, I gated this change with ifdefs. In case we don't have it by 
default, we can always can easily enable it with a simple 
`-DPy_IMMORTAL_INSTANCES` flag to the compiler.

> Also note that this is an ABI change as those INCREF and DECREF definitions 
> are intentionally public .h file

This has indeed been a bit of a pain for us as well. Due to how our tooling is 
set-up, there's a small number of third party libraries that are still causing 
Copy on Writes. Fortunately, that's the only drawback. Even if your 
immortalized object goes through an extension that has a different 
Py_{DECREF,INCREF} implementation, the reference count will still be so large 
that it will never be deallocated.

--

___
Python tracker 

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



[issue40218] sys.executable is a false path if python is executed from gdb

2020-04-11 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue40218] sys.executable is a false path if python is executed from gdb

2020-04-11 Thread Ammar Askar


Ammar Askar  added the comment:

The reason you're seeing gdb still work even when all Pythons are deleted is 
because it embeds a Python interpreter in itself 
(https://docs.python.org/3/extending/embedding.html).

This issue is thus out of scope here and belongs on the gdb tracker, but I can 
tell you it's caused by these lines: 
https://github.com/bminor/binutils-gdb/blob/de7ac122a7f98c181c1ec175b0560bb48eabc6ea/gdb/python/python.c#L1668-L1694

The Py_SetProgramName() is what informs the sys.executable value.

--
nosy: +ammar2

___
Python tracker 

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



[issue40258] random module does not have type hints

2020-04-11 Thread Nik Vaessen


Change by Nik Vaessen :


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

___
Python tracker 

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



[issue40126] Incorrect error handling in unittest.mock

2020-04-11 Thread Barry McLarnon


Barry McLarnon  added the comment:

Issue still exists in 3.7 and below, as it was part of a different function 
before. Current PR doesn't resolve the original issue that was raised.

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



[issue40258] random module does not have type hints

2020-04-11 Thread Nik Vaessen


Change by Nik Vaessen :


--
nosy: nikvaes
priority: normal
severity: normal
status: open
title: random module does not have type hints
type: enhancement

___
Python tracker 

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



[issue40255] Fixing Copy on Writes from reference counting

2020-04-11 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Thanks for sharing!  It's good to have a patch implementing for others who 
might need it to try out.

We experimented with an implementation of this on CPython 2.7 that we called 
Eternal Refcounts for YouTube many years ago.  For the same reason (saving 
memory in forked workers by not dirtying pages of known needed objects via 
refcount changes).

I don't have that old patch handy right now, but looking at yours it was the 
same concept: A magic refcount value to branch based on.

We wound up not deploying it or pushing for it in CPython because the CPU 
performance implications of adding a branch instruction to Py_INCREC and 
Py_DECREF were, unsurprisingly, quite high.  I'd have to go digging to find 
numbers but it _believe_ it was on the order of a 10% slowdown on real world 
application code.  (microbenchmarks don't tell a good story, the python 
performance test suite should)

Given that most people's applications don't fork workers, I do not expect to 
see such an implementation ever become the default.  It is a very appropriate 
hack, but the use case is limited to applications that don't use threads, are 
on POSIX, and always fork() many workers.

Also note that this is an ABI change as those INCREF and DECREF definitions are 
intentionally public .h file macros or inlines and thus included within any 
compiledcode rather than being an expensive function call elsewhere (vstinner's 
new alternate higher level API proposal presumably changes this).  If an 
interpreter with this loaded a binary using the CPython API built against 
headers without it, your refcounts could get messed up.

--
nosy: +gregory.p.smith
type:  -> enhancement

___
Python tracker 

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



[issue39951] Ignore specific errors when closing ssl connections

2020-04-11 Thread SilentGhost


Change by SilentGhost :


--
nosy: +christian.heimes

___
Python tracker 

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



[issue40257] Improve the use of __doc__ in pydoc

2020-04-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue40257] Improve the use of __doc__ in pydoc

2020-04-11 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Currently pydoc outputs __doc__ for classes, functions, methods, properties, 
etc (using inspect.getdoc()). If the object itself does not have non-empty 
__doc__, it searches non-empty __doc__ in the class parenthesis (if the object 
is a class) or in the corresponding overloaded members of the class to which 
the object (method, property, etc) belongs.

There are several problems with this.

1. Using the docstring of a parent class is misleading in most classes, 
especially if it is a base or abstract class (like object, Exception, Mapping).

2. If the object does not have the __doc__ attribute, it inherits it from its 
class, so inspect.getdoc(1) returns the same as inspect.getdoc(int).

3. If the object has own docstring, but is not a class or function, it will be 
output in the section DATA without a docstring.

The following PR fixes these issues.

1. Docstrings for classes are not inherited. It is better to not output a 
docstring than output the wrong one.

2. inspect.getdoc() returns the object's own docstring.

3. Docstrings are always output for object with a docstring. See for example 
help(typing).

In future issues I'll make help(typing) even more informative.

--
components: Library (Lib)
messages: 366220
nosy: gvanrossum, levkivskyi, ncoghlan, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: Improve the use of __doc__ in pydoc
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



[issue39953] Let's update ssl error codes

2020-04-11 Thread miss-islington


miss-islington  added the comment:


New changeset 2714c907df7cfe97911df6ce90364001270d9a43 by Miss Islington (bot) 
in branch '3.8':
closes bpo-39953: Update OpenSSL error codes table. (GH-19082)
https://github.com/python/cpython/commit/2714c907df7cfe97911df6ce90364001270d9a43


--

___
Python tracker 

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



[issue39953] Let's update ssl error codes

2020-04-11 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 3e0dd3730b5eff7e9ae6fb921aa77cd26efc9e3a by Benjamin Peterson in 
branch 'master':
closes bpo-39953: Update OpenSSL error codes table. (GH-19082)
https://github.com/python/cpython/commit/3e0dd3730b5eff7e9ae6fb921aa77cd26efc9e3a


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



[issue39953] Let's update ssl error codes

2020-04-11 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue40256] Python 3.8 Not Launching on Bootcamp Windows 10.

2020-04-11 Thread SilentGhost


Change by SilentGhost :


--
type: crash -> behavior

___
Python tracker 

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



[issue40221] Use new _at_fork_reinit() lock method in multiprocessing

2020-04-11 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue40256] Python 3.8 Not Launching on Bootcamp Windows 10.

2020-04-11 Thread Yusuf Mumtaz


New submission from Yusuf Mumtaz :

Hello.
I am having trouble running python IDLE on Windows 10 Bootcamp. When searching 
and opening from windows taskbar, no window appears and nothing else appears to 
happen.

Please help me!

--
components: Windows
messages: 366217
nosy: YusufM, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Python 3.8 Not Launching on Bootcamp Windows 10.
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



[issue40255] Fixing Copy on Writes from reference counting

2020-04-11 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +pablogsal

___
Python tracker 

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



[issue40255] Fixing Copy on Writes from reference counting

2020-04-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +nascheme, pitrou, tim.peters

___
Python tracker 

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



[issue40246] Different error messages for same error - invalid string prefixes

2020-04-11 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


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

___
Python tracker 

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



[issue40255] Fixing Copy on Writes from reference counting

2020-04-11 Thread Eddie Elizondo


Change by Eddie Elizondo :


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

___
Python tracker 

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



[issue40255] Fixing Copy on Writes from reference counting

2020-04-11 Thread Eddie Elizondo


New submission from Eddie Elizondo :

Copy on writes are a big problem in large Python application that rely on 
multiple processes sharing the same memory.

With the implementation of `gc.freeze`, we've attenuated the problem by 
removing the CoW coming from the GC Head. However, reference counting still 
causes CoW.

This introduces Immortal Instances which allows the user to bypass reference 
counting on specific objects and avoid CoW on forked processes.

Immortal Instances are specially useful for applications that cache heap 
objects in shared memory which live throughout the entire execution (i.e 
modules, code, bytecode, etc.)

--
components: Interpreter Core
messages: 366216
nosy: eelizondo
priority: normal
severity: normal
status: open
title: Fixing Copy on Writes from reference counting
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



[issue40246] Different error messages for same error - invalid string prefixes

2020-04-11 Thread Guido van Rossum

Guido van Rossum  added the comment:

yes

On Sat, Apr 11, 2020 at 04:46 Lysandros Nikolaou 
wrote:

>
> Lysandros Nikolaou  added the comment:
>
> I have working code that checks if there is a quotation mark right after
> an identifier. Here is an example:
>
> ╰─ ./python
> Python 3.9.0a5+ (heads/pegen-dirty:502dfb719e, Apr 11 2020, 14:43:12)
> [GCC 9.2.1 20191008] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> ur''
>   File "", line 1
> ur''
>  ^
> SyntaxError: invalid string prefix
>
> One observation about this is that it has precedence over an EOL error:
>
> >>> ur'
>   File "", line 1
> ur'
>  ^
> SyntaxError: invalid string prefix
>
> Would that be acceptable?
>
> --
>
> ___
> Python tracker 
> 
> ___
>
-- 
--Guido (mobile)

--

___
Python tracker 

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



[issue40253] Fix .py(w) file association with Pyhon 3 Windows installer

2020-04-11 Thread Eryk Sun


Eryk Sun  added the comment:

> How do I get to the "rocket" launcher? 

The py.exe launcher is installed by default with the Python 3 distribution from 
python.org. Did you install that, or did you install the app distribution from 
the Microsoft Store?

--

___
Python tracker 

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



[issue26571] turtle regression in 3.5

2020-04-11 Thread Furkan Onder


Furkan Onder  added the comment:

PR has been sent.

--

___
Python tracker 

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



[issue40253] Fix .py(w) file association with Pyhon 3 Windows installer

2020-04-11 Thread virtualnobi

virtualnobi  added the comment:

Eryk - thanks for your response. 

> I recommend selecting the installed "Python.File" progid instead. 
> It's the "Python" app with the launcher icon that has a rocket on it.

I don't have a Python with rocket launcher. When I use "Open With" on Windows 
Explorer, I only have two Python icons with the yin-yan snakes, one with white 
background (I presume that's still 2.7, as the  file icons were white before), 
and one with black background (which is available since I installed 3.8). If I 
select "Choose default program" (or similar - I have a German Windows), the 
list still only contains these two Python icons, and lot of unrelated stuff 
(zip, thunderbird, etc.). Initially, the black-background Python was not in 
this list at all, and I continued by "Further Options" and used the resulting 
browser to pick the 3.8 version. Since then, I have white and black Pythons. 

How do I get to the "rocket" launcher? 

Danke & Grüße von nobi

--

___
Python tracker 

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



[issue19468] Relax the type restriction on reloaded modules

2020-04-11 Thread Furkan Onder


Furkan Onder  added the comment:

PR has been sent.

--

___
Python tracker 

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



[issue21760] inspect documentation describes module type inaccurately

2020-04-11 Thread Furkan Onder


Furkan Onder  added the comment:

PR has been sent.

--

___
Python tracker 

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



[issue40244] AIX: build: _PyObject_GC_TRACK Asstertion failure

2020-04-11 Thread Stefan Krah


Change by Stefan Krah :


--
nosy:  -skrah

___
Python tracker 

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



[issue40244] AIX: build: _PyObject_GC_TRACK Asstertion failure

2020-04-11 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

I've just compiled python with (xlc 16.1.0, debug build) and can't experience 
that compile failure, can you give a specific spot that failure happens?

-bash-4.4$ ./python -m test.pythoninfo|grep -E 'CFLAGS|CC|OPT|LDFLAGS'
sysconfig[CC]: /opt/IBM/xlc/16.1.0/bin/xlc_r
sysconfig[CFLAGS]: -DNDEBUG -O
sysconfig[CONFIG_ARGS]: 'CC=/opt/IBM/xlc/16.1.0/bin/xlc_r'
sysconfig[OPT]: -DNDEBUG -O
sysconfig[PY_CFLAGS]: -DNDEBUG -O
sysconfig[PY_CFLAGS_NODIST]: -I./Include/internal
sysconfig[PY_STDMODULE_CFLAGS]: -DNDEBUG -O -I./Include/internal -I. -I./Include

--

___
Python tracker 

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



[issue40235] confusing documentation for IOBase.__exit__

2020-04-11 Thread Daniel Holth


Daniel Holth  added the comment:

Thanks, I'm sorry I didn't save when I was having my strange problem.

The io module is still practically undocumented. It should have examples 
subclasses for each class, perhaps a link to the PEP and a link to a Python 
implementation of the module.

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



[issue40221] Use new _at_fork_reinit() lock method in multiprocessing

2020-04-11 Thread Dong-hee Na


Dong-hee Na  added the comment:

we should find all usages from Lib/multiprocessing/*.py

--

___
Python tracker 

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



[issue40218] sys.executable is a false path if python is executed from gdb

2020-04-11 Thread Volker Weißmann

Volker Weißmann  added the comment:

"I have never used gdb, but I am curious what *is* the path to the python 
running the python code after 'python'? Is it part of or included with gdb?"
I honestly don't know. I think the python interpreter gets compiled into the 
python binary, because as a test, I removed every python interpreter on my 
system that I could find and the "python" command inside gdb still worked. But 
it uses some of pythons shared libraries that get installed when you install 
python.

I also suspect that it is a bug in gdb.
I think the only thing you can do is take a look at python's source code on how 
it finds sys.executable and check if it looks fishy or if it looks like it 
should never point to a non existing file. And we can wait if the gdb 
programmers will respond.

--

___
Python tracker 

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



[issue40225] recursive call within generator expression is O(depth)

2020-04-11 Thread Mark Shannon


Change by Mark Shannon :


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

___
Python tracker 

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



[issue40221] Use new _at_fork_reinit() lock method in multiprocessing

2020-04-11 Thread Dong-hee Na


Dong-hee Na  added the comment:

I am going to take a look

--

___
Python tracker 

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



[issue40225] recursive call within generator expression is O(depth)

2020-04-11 Thread Mark Shannon


Mark Shannon  added the comment:

The problem is that generators always raise an exception, even when they 
terminate normally.
They don't in 2.7 and didn't prior to 
https://github.com/python/cpython/commit/1f7ce62bd61488d5d721896a36a1b43befab88b5#diff-23c87bfada1d01335a3019b9321502a0

--

___
Python tracker 

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



[issue40203] Warn about invalid PYTHONUSERBASE

2020-04-11 Thread Volker Weißmann

Volker Weißmann  added the comment:

"there is no good reason to do so" meant that there is no good reason to set 
PYTHONUSERBASE to non existing path or a path that is not a directory.

The history behind this bug report is that I used a program that, because of a 
bug in this program, set PYTHONUSERBASE to a non existing path, and I wondered 
why "import cython" raised a ModuleNotFoundError even though I had installed 
cython.

--

___
Python tracker 

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



[issue40246] Different error messages for same error - invalid string prefixes

2020-04-11 Thread Lysandros Nikolaou

Lysandros Nikolaou  added the comment:

I have working code that checks if there is a quotation mark right after an 
identifier. Here is an example:

╰─ ./python
Python 3.9.0a5+ (heads/pegen-dirty:502dfb719e, Apr 11 2020, 14:43:12) 
[GCC 9.2.1 20191008] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> ur''
  File "", line 1
ur''
 ^
SyntaxError: invalid string prefix

One observation about this is that it has precedence over an EOL error:

>>> ur'
  File "", line 1
ur'
 ^
SyntaxError: invalid string prefix

Would that be acceptable?

--

___
Python tracker 

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



[issue40253] Fix .py(w) file association with Pyhon 3 Windows installer

2020-04-11 Thread Eryk Sun


Eryk Sun  added the comment:

An "Applications\python.exe" progid gets created by browsing for "python.exe" 
when configuring the file association. For example, it gets created by the 
Windows shell (Explorer) via "open with" -> "choose another app" -> "look for 
another app on this PC". The shell has no option in this case to indicate that 
the filetype is a script that needs command-line arguments via "%*", so the 
"shell\open\command" template that it assigns is incorrect.

If the user also selects to "always use this app", the shell sets a 
"UserChoice" key in a key named for the file extension under 
"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts". The user 
choice overrides the default association computed via HKCR settings. 
Applications are not supposed to meddle with the "UserChoice" key. Its contents 
are doubly protected by the key's security and a hash value.

The shell key for the file extension usually has two other subkeys: 
"OpenWithList" and "OpenWithProgids". These can also override the HKCR file 
association. The "OpenWithList" key lists executables that have been used to 
open the filetype via the "open with" menu, and it also contains an "MRUList" 
value that sorts the list by order of most recently used. The "OpenWithProgids" 
key caches progids that are used to open the program. Usually there's just one 
cached progid. But if there's more than one, in my experience the shell selects 
the progid that's associated with the first exectuable in the "OpenWithList", 
by order of the "MRUList" value. In this particular and peculiar case, the 
current file association follows whichever program was most recently selected 
in the "open with" list.

> I found this report which fixed the problem: 
> https://stackoverflow.com/questions/15281951

Continuing to use the shell-generated "Applications\python.exe" progid means 
that you won't have shebang support provided by the py.exe launcher (e.g. for 
associating scripts with particular virtual environments), the "Edit with IDLE" 
menu, or the shell-extension drop handler. 

I recommend selecting the installed "Python.File" progid instead. It's the 
"Python" app with the launcher icon that has a rocket on it. If you use the 
"open with" menu to select this progid, also select the option to always use 
the selected app. This sets the shell's "UserChoice" key to lock down the file 
association.

FYI, never modify the HKCR merged view as suggested by the linked SO answer. 
Modify the source hive in "HKCU\Software\Classes" or "HKLM\Software\Classes". 
If you modify HKCR directly, the key(s) that you end up modifying could be in 
one or the other hive depending on what's already present (e.g. you could 
modify a value just for the current user, though your intent is to modify it 
for all users). You should know whether you need to modify system settings, 
user settings, or both. If you don't know, you need to do more research before 
proceeding.

--
nosy: +eryksun

___
Python tracker 

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



[issue40225] recursive call within generator expression is O(depth)

2020-04-11 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

I've been looking at this, I find the effect more visible when you don't do the 
division in the last print().

After bisecting, it looks like ae3087c6382011c47db82fea4d05f8bbf514265d may 
account for most of the performance gap between 3.6 and 3.7.

--

___
Python tracker 

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



[issue40237] Test code coverage (C) job of Travis CI fails on test_distutils which creates _configtest.gcno file

2020-04-11 Thread hai shi


hai shi  added the comment:

FWIW, gcc Instrumentation Options in 
https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html

--

___
Python tracker 

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



[issue40237] Test code coverage (C) job of Travis CI fails on test_distutils which creates _configtest.gcno file

2020-04-11 Thread hai shi


hai shi  added the comment:

After `CFLAGS` replcaced by `CFLAGS_NODIST`, some extension module built 
failed, some info like:
*** WARNING: renaming "_struct" since importing it failed: 
build/lib.linux-x86_64-3.9/_struct.cpython-39-x86_64-linux-gnu.so: undefined 
symbol: __gcov_merge_add

the possible reason:
building '_struct' extension
gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 
-Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers -Werror=implicit-function-declaration 
-fvisibility=hidden -O0 -pg --coverage -I./Include/internal -I./Include -I. 
-I/usr/local/include -I/temp/shihai/cpython/Include -I/temp/shihai/cpython -c 
/temp/shihai/cpython/Modules/_struct.c -o 
build/temp.linux-x86_64-3.9/temp/shihai/cpython/Modules/_struct.o
gcc -pthread -shared (xxlacking --coverage in here x) 
build/temp.linux-x86_64-3.9/temp/shihai/cpython/Modules/_struct.o 
-L/usr/local/lib -o 
build/lib.linux-x86_64-3.9/_struct.cpython-39-x86_64-linux-gnu.so

--

___
Python tracker 

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



[issue40246] Different error messages for same error - invalid string prefixes

2020-04-11 Thread Lysandros Nikolaou


Lysandros Nikolaou  added the comment:

In my understanding of the C code that's what the C tokenizer is doing as well.

Here's the relevant snippet of the tokenizer 
(https://github.com/python/cpython/blob/4b222c9491d1700e9bdd98e6889b8d0ea1c7321e/Parser/tokenizer.c#L1358):
 When the tokenizer sees a valid identifier start, it goes into a loop that 
checks for a valid combination of string prefixes. If the combination is valid 
and it sees a quote directly after that, it goto's to the STRING-handling code. 
If not, then it breaks out of the loop and returns a NAME node.

Am I missing something?

--

___
Python tracker 

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



[issue39943] Meta: Clean up various issues in C internals

2020-04-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +18827
pull_request: https://github.com/python/cpython/pull/19472

___
Python tracker 

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



[issue40254] pyspecific directives are not translatable

2020-04-11 Thread Tomohiko Kinebuchi


Change by Tomohiko Kinebuchi :


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

___
Python tracker 

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



[issue40254] pyspecific directives are not translatable

2020-04-11 Thread Tomohiko Kinebuchi


New submission from Tomohiko Kinebuchi :

The new mechanism of Sphinx for internationalization was introduced at Sphinx 
1.8, but directives implemented on pyspecific.py were not updated to follow 
that renewal.
As a result, the text of these directives is left untranslated.
(e.g. https://docs.python.org/ja/3.8/library/array.html)

--
assignee: docs@python
components: Documentation
messages: 366196
nosy: cocoatomo, docs@python
priority: normal
severity: normal
status: open
title: pyspecific directives are not translatable
type: behavior
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



[issue40129] Add test classes for custom __index__, __int__, __float__ and __complex__

2020-04-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue40126] Incorrect error handling in unittest.mock

2020-04-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 4b222c9491d1700e9bdd98e6889b8d0ea1c7321e by Serhiy Storchaka in 
branch 'master':
bpo-40126: Fix reverting multiple patches in unittest.mock. (GH-19351)
https://github.com/python/cpython/commit/4b222c9491d1700e9bdd98e6889b8d0ea1c7321e


--

___
Python tracker 

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



[issue39943] Meta: Clean up various issues in C internals

2020-04-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset cd8295ff758891f21084a6a5ad3403d35dda38f7 by Serhiy Storchaka in 
branch 'master':
bpo-39943: Add the const qualifier to pointers on non-mutable PyUnicode data. 
(GH-19345)
https://github.com/python/cpython/commit/cd8295ff758891f21084a6a5ad3403d35dda38f7


--

___
Python tracker 

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



[issue40235] confusing documentation for IOBase.__exit__

2020-04-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I cannot reproduce the issue. __exit__() calls close().

>>> import io
>>> class F(io.IOBase):
... def close(self):
... print('close')
... super().close()  # set closed = True
... 
>>> with F(): pass
... 
close

--
nosy: +serhiy.storchaka
status: open -> pending

___
Python tracker 

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



[issue40199] Invalid escape sequence DeprecationWarnings don't trigger by default

2020-04-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue40253] Fix .py(w) file association with Pyhon 3 Windows installer

2020-04-11 Thread virtualnobi

New submission from virtualnobi :

Recently installed Python 3.8 (from 2.7) on Windows 10, and all my scripts 
didn't work anymore. For some strange reason 

> python -s script.py args

would put the args into sys.argv[], while

> script.py args

would only show the script in sys.argv[]. I found this report which fixed the 
problem: 

https://stackoverflow.com/questions/15281951/sys-argv-contents-when-calling-python-script-implicitly-on-windows

(Basically, the .py(w) association in the registry need an additional '%*' 
parameter to pass the script parameters.)

So I assume the Python 3 Windows installer overwrote my earlier registry 
associations. 

The other way the problem happened could be that the Python 3 installer did not 
change the registry assocation to 3.8, and I did this manually. I verified that 
setting a "default program" for windows will put the deficient association 
(without argument passing) into the registry. 

Either way, I would expect that after installing Python 3.8, my scripts would 
really run with 3.8, and with their arguments. :-) 

Danke & Grüße von 
nobi

--
components: Installation, Windows
messages: 366192
nosy: paul.moore, steve.dower, tim.golden, virtualnobi, zach.ware
priority: normal
severity: normal
status: open
title: Fix .py(w) file association with Pyhon 3 Windows installer
type: behavior
versions: Python 3.8

___
Python tracker 

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