[issue38627] Add copy() method to pathlib

2019-10-28 Thread Sebastian Linke


New submission from Sebastian Linke :

pathlib.Path() could wrap shutil.copy() with something like this:

def copy(self, target):
if not self.is_file():
# No support for directories here
raise ValueError("Path must point to a regular file")
# copy() appends filename when Path is copied to a directory
# see shutil.copy() docstring and source for details
target = shutil.copy(self, target)
return self.__class__(target)

--
components: Library (Lib)
messages: 355616
nosy: seblin
priority: normal
severity: normal
status: open
title: Add copy() method to pathlib
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



[issue37523] zipfile: Raise ValueError for i/o operations on closed zipfile.ZipExtFile

2019-10-28 Thread Daniel Hillier


Daniel Hillier  added the comment:

Here's the script I used for profiling and the results I observed with and 
without the closed check in read:

import zipfile

test_zip = "time_test.zip"
test_name = "test_name.txt"

with zipfile.ZipFile(test_zip, "w") as zf:
zf.writestr(test_name, "Hi there! " * 300)

with zipfile.ZipFile(test_zip) as zf:
for i in range(10):
zf.read(test_name)

# Current code (no closed check), three different profiling sessions:
# ncalls  tottime  percall  cumtime  percall filename:lineno(function)
# 100.6120.0006.6380.000 zipfile.py:884(read)
# 100.5980.0006.4890.000 zipfile.py:884(read)
# 100.6000.0006.4850.000 zipfile.py:884(read)

# With closed check, three different profiling sessions:
# ncalls  tottime  percall  cumtime  percall filename:lineno(function)
# 100.6320.0006.5870.000 zipfile.py:884(read)
# 100.6230.0006.5640.000 zipfile.py:884(read)
# 100.6380.0006.7000.000 zipfile.py:884(read)

---

I based this change on the what BytesIO does: 
https://github.com/python/cpython/blob/master/Lib/_pyio.py#L912

Let me know if you want me to make any changes.

--

___
Python tracker 

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



[issue38243] A reflected XSS in python/Lib/DocXMLRPCServer.py

2019-10-28 Thread Larry Hastings


Change by Larry Hastings :


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

___
Python tracker 

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



[issue38243] A reflected XSS in python/Lib/DocXMLRPCServer.py

2019-10-28 Thread Larry Hastings


Larry Hastings  added the comment:


New changeset 3fe1b19265b55c290fc956e9aafcf661803782de by larryhastings (Victor 
Stinner) in branch '3.5':
bpo-38243, xmlrpc.server: Escape the server_title (GH-16373) (GH-16441) (#16516)
https://github.com/python/cpython/commit/3fe1b19265b55c290fc956e9aafcf661803782de


--
nosy: +larry

___
Python tracker 

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



[issue38608] Undocumented behavior that IsolatedAsyncioTestCase would enable event loop debug mode

2019-10-28 Thread Wei-Cheng Pan


Wei-Cheng Pan  added the comment:

> Usually, it is a sign of a problem in user code, e.g. something should be 
> pushed into executor.

Sometimes also happens on low-end CI machines.

And the message is somewhat unclear to me.
I have to grep cpython sources to understand that it is coming from debug mode 
and it means there is a slow awaitable ... in somewhere, because the displayed 
file:line is not always the right position.

> A test case is executed in debug mode. I think it is reasonable for the test 
> run, isn't it?

Probably.

> The mode can be disabled by `asyncio.get_running_loop().set_debug(False)` in 
> `asyncSetUp()` method.

Glad to know that. Thanks.

--

___
Python tracker 

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



[issue38626] small change at bisect_left function for easy understanding

2019-10-28 Thread miss-islington


miss-islington  added the comment:


New changeset 3c88199e0be352c0813f145d7c4c83af044268aa by Miss Skeleton (bot) 
(Raymond Hettinger) in branch 'master':
bpo-38626:  Add comment explaining why __lt__ is used. (GH-16978)
https://github.com/python/cpython/commit/3c88199e0be352c0813f145d7c4c83af044268aa


--
nosy: +miss-islington

___
Python tracker 

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



[issue34790] Deprecate passing coroutine objects to asyncio.wait()

2019-10-28 Thread Kyle Stanley


Kyle Stanley  added the comment:

> Is this whatsnew/3.8.rst entry correct and complete?

> The :func:`asyncio.coroutine` :term:`decorator` is deprecated and will be 
> removed in version 3.10.  Instead of ``@asyncio.coroutine``, use 
> :keyword:`async def` instead. (Contributed by Andrew Svetlov in 
> :issue:`36921`.)

It looks to be fully consistent with the asyncio docs: 
https://docs.python.org/3/library/asyncio-task.html#generator-based-coroutines. 
From the blame of the documentation, it seems like Yury added the deprecation 
notice (GH-9314) to that section with the listed release for removal as 4.0, 
and then changed it to 3.10 (GH-9579). At a later date, Andrew implemented the 
actual deprecation (GH-13346).

So as far as I can tell, yes.

--

___
Python tracker 

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



[issue38626] small change at bisect_left function for easy understanding

2019-10-28 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +16504
pull_request: https://github.com/python/cpython/pull/16978

___
Python tracker 

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



[issue38618] Why not use refcount of c.c_filename in PyAST_FromNodeObject()

2019-10-28 Thread hai shi


hai shi  added the comment:

Thanks for your patience, Serhiy.

IMHO, i called the moving operation `clean code`: Consistent understanding, 
Consistent code. And the `clean code` should be a part of `enhancement`.

--

___
Python tracker 

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



[issue34790] Deprecate passing coroutine objects to asyncio.wait()

2019-10-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Is this whatsnew/3.8.rst entry correct and complete?

'''
The :func:`asyncio.coroutine` :term:`decorator` is deprecated and will be 
removed in version 3.10.  Instead of ``@asyncio.coroutine``, use 
:keyword:`async def` instead. (Contributed by Andrew Svetlov in :issue:`36921`.)
'''

--
nosy: +rhettinger

___
Python tracker 

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



[issue38626] small change at bisect_left function for easy understanding

2019-10-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I concur with Tim.

Thank you for the suggestion though.

--
nosy: +rhettinger
resolution:  -> rejected
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



[issue38626] small change at bisect_left function for easy understanding

2019-10-28 Thread Tim Peters


Tim Peters  added the comment:

So as far as possible, CPython only uses __lt__ ("<") element comparisons for 
its order-sensitive algorithms.  This is documented for list.sort(), but the 
bisect and heapq modules strive to do the same.

The point is to minimize the number of comparison methods a new type needs to 
implement to participate (and "just one:  __lt__" is ideal).

Your change would require they implement "__le__" too, so is unlikely to be 
accepted for CPython.

--
assignee: rhettinger -> 
nosy: +tim.peters -rhettinger

___
Python tracker 

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



[issue38626] small change at bisect_left function for easy understanding

2019-10-28 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue38626] small change at bisect_left function for easy understanding

2019-10-28 Thread Windson Yang


New submission from Windson Yang :

bisect_left should be similar to bisect_right. However, the current implement 
didn't reflect it. A little bit update for the bisect_left function could make 
the user easy to understand their relation.

def bisect_left(a, x, lo=0, hi=None):
if lo < 0:
raise ValueError('lo must be non-negative')
if hi is None:
hi = len(a)
while lo < hi:
mid = (lo+hi)//2
# <= should be the only difference between bisect_left and bisect_right
if x <= a[mid]: hi = mid
else: lo = mid+1
return lo

--
components: Library (Lib)
messages: 355606
nosy: Windson Yang
priority: normal
severity: normal
status: open
title: small change at bisect_left function for easy understanding
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



[issue38125] Can' build document in Sphinx v2.2.0

2019-10-28 Thread Windson Yang


Change by Windson Yang :


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



[issue38624] pathlib .suffix, .suffixes, .stem unexpected behavior for pathname with trailing dot

2019-10-28 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +pitrou

___
Python tracker 

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



[issue34790] Deprecate passing coroutine objects to asyncio.wait()

2019-10-28 Thread Kyle Stanley


Kyle Stanley  added the comment:

GH-16977 Implements the deprecation warning, adds tests, and adds the 3.9 
whatsnew entry. Once this PR is finalized, I think this issue can be closed.

--
stage: patch review -> 

___
Python tracker 

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



[issue34790] Deprecate passing coroutine objects to asyncio.wait()

2019-10-28 Thread Kyle Stanley


Change by Kyle Stanley :


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

___
Python tracker 

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



[issue38334] zipfile: Seeking encrypted file breaks after seeking backwards

2019-10-28 Thread Daniel Hillier


Daniel Hillier  added the comment:

Thanks for your help! Good point, I'll create a new change for the refactoring.

--

___
Python tracker 

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



[issue34790] Deprecate passing coroutine objects to asyncio.wait()

2019-10-28 Thread Kyle Stanley


Kyle Stanley  added the comment:

GH-16975 Is a simple fix for the asyncio.wait() whatsnew entry for 3.8. I'll 
implement the deprecation warning and add a 3.9 whatsnew entry in a separate 
PR, since those changes won't be backported.

--
stage: patch review -> 

___
Python tracker 

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



[issue34790] Deprecate passing coroutine objects to asyncio.wait()

2019-10-28 Thread Kyle Stanley


Change by Kyle Stanley :


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

___
Python tracker 

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



[issue38625] SpooledTemporaryFile does not seek correctly after being rolled over

2019-10-28 Thread Graham Coster


New submission from Graham Coster :

Hi there,

As demonstrated in the attached script, I found that a StopIteration exception 
occurs once a SpooledTemporaryFile has been rolled over from memory to disk, 
even though seek(0) had move the file position to the top of the file.

I had previously been using a TemporaryFile, which wrote directly to disk, 
without any issues.  However, once I swapped to a SpooledTemporaryFile, the 
StopIteration exception started to appear.  

I'm guessing the problem relates to the csv reader having an Iterator that is 
no longer looking at the correct file after the SpooledTemporaryFile is 
rolled-over.  I found that instantiating a new csv reader post roll-over works 
around the problem.

I had expected that I could just swap from a TemporaryFile to a 
SpooledTemporaryFile with no change to behaviour. However, if this is not the 
case, perhaps the SpooledTemporaryFile documentation should explicitly state 
this.

Cheers, Graham.

--

___
Python tracker 

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



[issue38625] SpooledTemporaryFile does not seek correctly after being rolled over

2019-10-28 Thread Graham Coster


Change by Graham Coster :


--
components: Library (Lib)
files: spooled-temp-file-does-not-seek-correctly-after-being-rolled.py
nosy: Gary Fernie, James Hennessy, graham.coster, inada.naoki, martin.panter, 
nubirstein, r.david.murray, serhiy.storchaka, terry.reedy
priority: normal
severity: normal
status: open
title: SpooledTemporaryFile does not seek correctly after being rolled over
type: behavior
versions: Python 3.7
Added file: 
https://bugs.python.org/file48685/spooled-temp-file-does-not-seek-correctly-after-being-rolled.py

___
Python tracker 

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



[issue38599] Deprecate creation of asyncio object when the loop is not running

2019-10-28 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

I'm pretty happy with asyncio.run() functionalit.

I used run() for the bug demonstration, but the example can be rewritten easily 
without this function.

The problem is not in run() but in an object lifecycle. Implicit loop creation 
plus module-level initialization provides a pretty big set of ways to shoot in 
the foot :)

--

___
Python tracker 

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



[issue38624] pathlib .suffix, .suffixes, .stem unexpected behavior for pathname with trailing dot

2019-10-28 Thread Inyeol Lee


New submission from Inyeol Lee :

Python3.8 pathlib treats dot between path stem and suffix as part of suffix in 
general:

>>> a = pathlib.Path('foo.txt')
>>> a.stem, a.suffix
('foo', '.txt')
>>> a.with_suffix('')
PosixPath('foo')

However, if pathname ends with dot, it treats the trailing dot as part of stem, 
not part of suffix:

>>> b = pathlib.Path('bar.')
>>> b.stem, b.suffix
('bar.', '')

This looks like a bug. It should return ('bar', '.').
There are couple of unexpected behavior related to this:

>>> pathlib.Path('foo.txt').with_suffix('.')
...
ValueError: Invalid suffix '.' <== Why not PosixPath('foo.') ?
>>> c = pathlib.Path('foo..')
>>> c.stem, c.suffix, c.suffixes
('foo..', '', [])

I think above should return ('foo.', '.', ['.', '.'])

Tested with macOS 10.15 and Python3.8. Python3.7 behaves the same.

--
components: Library (Lib)
messages: 355600
nosy: inyeollee
priority: normal
severity: normal
status: open
title: pathlib .suffix, .suffixes, .stem unexpected behavior for pathname with 
trailing dot
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



[issue38623] Python documentation should mention how to find site-packages

2019-10-28 Thread Peter Bittner


Change by Peter Bittner :


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

___
Python tracker 

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



[issue38623] Python documentation should mention how to find site-packages

2019-10-28 Thread Peter Bittner


New submission from Peter Bittner :

A popular question on StackOverflow is, "How do I find the location of my 
Python site-packages directory?" [1]

While this may hint at a deeper problem that needs to be solved, a user 
suggested [2] the accepted answer to be added to Python's official 
documentation.

The most appropriate place I could find to add related information is 
``Doc/tutorial/modules.rst``.

[1] 
https://stackoverflow.com/questions/122327/how-do-i-find-the-location-of-my-python-site-packages-directory/46071447
[2] 
https://stackoverflow.com/questions/122327/how-do-i-find-the-location-of-my-python-site-packages-directory/46071447#comment103247041_46071447

--
assignee: docs@python
components: Documentation
messages: 355599
nosy: bittner, docs@python
priority: normal
severity: normal
status: open
title: Python documentation should mention how to find site-packages
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue38599] Deprecate creation of asyncio object when the loop is not running

2019-10-28 Thread Yury Selivanov


Yury Selivanov  added the comment:

> Well, I'm basically using a run method defined as a shorthand for 
> self.loop.run_until_complete (without closing loop, reusing it throughout). 
> It would be nice if asyncio.run could simply be used instead, but I 
> understand you're saying this is easier said than done, which is fine with 
> me. Thanks.

Yes. `asyncio.run()` is similar to `loop.run_until_complete()` but adds some 
guarantees + sane setup/cleanup. If we strip proper cleanup then there's no 
point in `asyncio.run()`.  So using `loop.run_until_complete()` is totally fine 
when you want to preserve the event loop between runs.

--

___
Python tracker 

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



[issue38599] Deprecate creation of asyncio object when the loop is not running

2019-10-28 Thread Berry Schoenmakers


Berry Schoenmakers  added the comment:

Well, I'm basically using a run method defined as a shorthand for 
self.loop.run_until_complete (without closing loop, reusing it throughout). It 
would be nice if asyncio.run could simply be used instead, but I understand 
you're saying this is easier said than done, which is fine with me. Thanks.

--

___
Python tracker 

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



[issue37330] open(): remove 'U' mode, deprecated since Python 3.3

2019-10-28 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +16499
pull_request: https://github.com/python/cpython/pull/16972

___
Python tracker 

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



[issue38589] Bad target address assigned in Python Manuals shortcut on Python installation

2019-10-28 Thread miss-islington


miss-islington  added the comment:


New changeset 2267cb9da4a1fd8bb4962beb893e1f69a37909a7 by Miss Skeleton (bot) 
in branch '3.8':
bpo-38589: Fixes HTML Help shortcut when Windows is not installed to C drive 
(GH-16968)
https://github.com/python/cpython/commit/2267cb9da4a1fd8bb4962beb893e1f69a37909a7


--

___
Python tracker 

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



[issue38589] Bad target address assigned in Python Manuals shortcut on Python installation

2019-10-28 Thread miss-islington


miss-islington  added the comment:


New changeset 379b55b526a04e6db40c7070fd70f0d7d37bba64 by Miss Skeleton (bot) 
in branch '3.7':
bpo-38589: Fixes HTML Help shortcut when Windows is not installed to C drive 
(GH-16968)
https://github.com/python/cpython/commit/379b55b526a04e6db40c7070fd70f0d7d37bba64


--
nosy: +miss-islington

___
Python tracker 

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



[issue38336] Remove the __set__ method restriction on data descriptors for attribute lookup precedence

2019-10-28 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
priority: normal -> low

___
Python tracker 

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



[issue38336] Remove the __set__ method restriction on data descriptors for attribute lookup precedence

2019-10-28 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: docs@python -> rhettinger

___
Python tracker 

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



[issue38618] Why not use refcount of c.c_filename in PyAST_FromNodeObject()

2019-10-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There is no bug. We can add Py_INCREF/Py_DECREF in ast.c. We can remove 
Py_INCREF/Py_DECREF from compile.c. But all this would just add code churn.

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



[issue38589] Bad target address assigned in Python Manuals shortcut on Python installation

2019-10-28 Thread Steve Dower


Change by Steve Dower :


--
assignee:  -> steve.dower
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



[issue38589] Bad target address assigned in Python Manuals shortcut on Python installation

2019-10-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16498
pull_request: https://github.com/python/cpython/pull/16971

___
Python tracker 

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



[issue38589] Bad target address assigned in Python Manuals shortcut on Python installation

2019-10-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16497
pull_request: https://github.com/python/cpython/pull/16970

___
Python tracker 

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



[issue38589] Bad target address assigned in Python Manuals shortcut on Python installation

2019-10-28 Thread Steve Dower


Steve Dower  added the comment:


New changeset 0ac6137dd3d1e2c8f9558153ad63021f57e05e73 by Steve Dower in branch 
'master':
bpo-38589: Fixes HTML Help shortcut when Windows is not installed to C drive 
(GH-16968)
https://github.com/python/cpython/commit/0ac6137dd3d1e2c8f9558153ad63021f57e05e73


--

___
Python tracker 

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



[issue38494] Add assert_not_called_with

2019-10-28 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue36723] Unittest Discovery for namespace subpackages dot notation fails

2019-10-28 Thread Phil Connell


Change by Phil Connell :


--
nosy: +pconnell

___
Python tracker 

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



[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2019-10-28 Thread Phil Connell


Change by Phil Connell :


--
nosy: +pconnell

___
Python tracker 

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



[issue25299] argparse: TypeError: __init__() takes at least 4 arguments (4 given)

2019-10-28 Thread Phil Connell


Change by Phil Connell :


--
nosy: +pconnell

___
Python tracker 

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



[issue35617] unittest discover does not work with implicit namespaces

2019-10-28 Thread Phil Connell


Change by Phil Connell :


--
nosy: +pconnell

___
Python tracker 

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



[issue38505] Mock.call_args and Mock.call_args_list not propagated to parent Mock

2019-10-28 Thread Phil Connell


Change by Phil Connell :


--
nosy: +pconnell

___
Python tracker 

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



[issue37052] Add examples for mocking async for and async context manager in unittest.mock docs

2019-10-28 Thread Phil Connell


Change by Phil Connell :


--
nosy: +pconnell

___
Python tracker 

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



[issue23882] unittest discovery doesn't detect namespace packages when given no parameters

2019-10-28 Thread Phil Connell


Change by Phil Connell :


--
nosy: +pconnell

___
Python tracker 

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



[issue18108] shutil.chown should support dir_fd and follow_symlinks keyword arguments

2019-10-28 Thread Phil Connell


Change by Phil Connell :


--
nosy: +pconnell

___
Python tracker 

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



[issue38494] Add assert_not_called_with

2019-10-28 Thread Phil Connell


Change by Phil Connell :


--
nosy: +pconnell

___
Python tracker 

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



[issue38122] AsyncMock force always creating an AsyncMock for child mocks

2019-10-28 Thread Phil Connell


Change by Phil Connell :


--
nosy: +pconnell

___
Python tracker 

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



[issue38384] An assertion failure in test_pickle

2019-10-28 Thread Phil Connell


Change by Phil Connell :


--
nosy: +pconnell

___
Python tracker 

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



[issue7897] Support parametrized tests in unittest

2019-10-28 Thread Phil Connell


Change by Phil Connell :


--
nosy: +pconnell

___
Python tracker 

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



[issue38091] Import deadlock detection causes deadlock

2019-10-28 Thread Phil Connell


Change by Phil Connell :


--
nosy: +pconnell

___
Python tracker 

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



[issue30587] Mock with spec object does not ensure method call signatures

2019-10-28 Thread Phil Connell


Change by Phil Connell :


--
nosy: +pconnell

___
Python tracker 

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



[issue32092] mock.patch with autospec does not consume self / cls argument

2019-10-28 Thread Phil Connell


Change by Phil Connell :


--
nosy: +pconnell

___
Python tracker 

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



[issue38483] [venv] Add ~/.venvrc to change module defaults

2019-10-28 Thread Cooper Lees


Cooper Lees  added the comment:

Updated PR to use venv.ini. Will fix any CI errors encountered.

--

___
Python tracker 

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



[issue31026] test_dbm fails when run directly

2019-10-28 Thread Larry Hastings


Larry Hastings  added the comment:

For what it's worth, I'm cherry-picking this back into 3.5 for 3.5.8 final.  I 
(finally?) got bit by this, and since the patch is literally only changes in 
the Lib/test directory I consider it safe to merge even after 3.5.8rc2.  (I was 
in a bit of a hurry, I didn't use the Python cherry picker technology, I just 
used "git cherry-pick".)

--
nosy: +larry

___
Python tracker 

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



[issue35448] ConfigParser .read() - handling of nonexistent files

2019-10-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

FWIW, I agree with closing this.  I already changed my mind from my earlier 
comment and decided that IDLE should maybe switch to using open and read_file 
in different places, for the reasons given above.  It might make testing 
without depending on a local config, which does not exist on buildbots, easier.

--

___
Python tracker 

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



[issue38599] Deprecate creation of asyncio object when the loop is not running

2019-10-28 Thread Yury Selivanov


Yury Selivanov  added the comment:

> It would be nice if asyncio.run() uses the default loop if it's available 
> (and not running), and that the default loop remains intact after the call 
> returns. 

Unfortunately it's not possible to implement that reliably and without a bunch 
of surprising behaviors.

Also, if you want the loop to be intact after asyncio.run, it means that you 
would not want to close it;that would defeat the purpose of asyncio.run.

--

___
Python tracker 

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



[issue38599] Deprecate creation of asyncio object when the loop is not running

2019-10-28 Thread Berry Schoenmakers


Berry Schoenmakers  added the comment:

The current implementation of asyncio.run() is focused quite a bit on one-shot 
use. After the call returns, the default event loop is even gone: calling 
asyncio.get_event_loop() gives "RuntimeError: There is no current event loop in 
thread 'MainThread'."

It would be nice if asyncio.run() uses the default loop if it's available (and 
not running), and that the default loop remains intact after the call returns. 

This way multiple calls to asyncio.run() that all use the default loop are 
supported, maybe using an asyncio.Queue (or whatever) across these 
calls---attaching everything to the same (default) loop.

I find this very useful, for instance when writing unit tests.

--
nosy: +lschoe

___
Python tracker 

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



[issue34975] start_tls() difficult when using asyncio.start_server()

2019-10-28 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

I think it should be closed; Yuri thinks that current streams API is frozen for 
the sake of shiny brand new streams (don't exist yet).

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue34975] start_tls() difficult when using asyncio.start_server()

2019-10-28 Thread Ian Good


Ian Good  added the comment:

#36889 was reverted, so this is not resolved.

I'm guessing this needs to be moved to 3.9 now too. Is my original PR worth 
revisiting? https://github.com/python/cpython/pull/13143/files

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

___
Python tracker 

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



[issue37838] typing.get_type_hints not working with forward-declaration and decorated functions

2019-10-28 Thread Netzeband

Netzeband  added the comment:

Hello,

I'm very sorry, I was not able to find the time to finish the patch in the 
quality I wanted to have. So @benedwards14 please feel free to provide a pull 
request.

Best regards,
André

--

___
Python tracker 

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



[issue38615] imaplib has no timeout setting

2019-10-28 Thread Eric V. Smith


Eric V. Smith  added the comment:

I think this is a reasonable request. It would have to be a 3.9 feature.

Perhaps some code (and tests) can be stolen from poplib.

--
nosy: +eric.smith
stage:  -> needs patch
versions:  -Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue38622] _ctypes.dlsym (py_dl_sym) does not trigger audit hooks

2019-10-28 Thread tholl


New submission from tholl :

The dlsym operation generally (e.g. when done through a ctypes.CDLL object) 
triggers the "ctypes.dlsym" audit event. However, using _ctypes.dlsym directly 
does not trigger this event. This appears to be an oversight, given that 
_ctypes.dlopen *does* trigger the "ctypes.dlopen" audit event.

A (very minimal) patch is attached.

I was not entirely sure what format the DLL handle should take when it is 
passed to the audit function, so for now it just turns it back into a number 
via PyLong_FromVoidPtr (i.e. into the same format in which it is passed into 
_ctypes.dlsym in the first place).

--
components: Extension Modules
files: audit.patch
keywords: patch
messages: 355583
nosy: tholl
priority: normal
severity: normal
status: open
title: _ctypes.dlsym (py_dl_sym) does not trigger audit hooks
versions: Python 3.8, Python 3.9
Added file: https://bugs.python.org/file48684/audit.patch

___
Python tracker 

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



[issue38534] Version 3.8.0 has released with a wrong MS KB number reference

2019-10-28 Thread miss-islington


miss-islington  added the comment:


New changeset a4ee7abd2056c4956df45125fcf451a531247017 by Miss Skeleton (bot) 
in branch '3.8':
bpo-38534: Replace wrong KB number references (GH-16955)
https://github.com/python/cpython/commit/a4ee7abd2056c4956df45125fcf451a531247017


--
nosy: +miss-islington

___
Python tracker 

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



[issue34938] Fix mimetype.init() to account for from import

2019-10-28 Thread Ashley Whetter


Ashley Whetter  added the comment:

Maybe updating the dictionaries isn't right at all.
I think if you were experienced enough you would have the intuition that 
mutable attributes like this are not going to change in your local scope if you 
import them into it. But relying on this knowledge makes it difficult for newer 
users. Plus we all make mistakes ;) So a note in the docs sounds like a good 
idea to me.

I think `init` does rebuild when `files` is `None` 
(https://github.com/python/cpython/blob/edb172a87296d9359593a23cd9a09f5867ea1f0e/Lib/mimetypes.py#L350)
 but it's not clear to me whether rebuilding should include any additional 
types registered with `add_type`. At the moment it says `the mapping will be 
added to the official MIME types`, but I think an additional note that this 
means that it will persist after subsequent calls to `init` would make that 
clear.

As for importing `init` into the local scope, I think ideally we wouldn't use 
`global` at all. We should be able to make `init` import `mimetypes` locally 
and explicitly access attributes on the module?
Another option is we make the module attributes accessible through a module 
level `__getattr__` which gets the attributes off of the global `Mimetypes` 
object stored in `mimetypes._db`. But that would still require usage of a 
`global _db`.

--
nosy: +AWhetter

___
Python tracker 

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



[issue38534] Version 3.8.0 has released with a wrong MS KB number reference

2019-10-28 Thread Steve Dower


Steve Dower  added the comment:

Thanks for the fix!

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



[issue38534] Version 3.8.0 has released with a wrong MS KB number reference

2019-10-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16496
pull_request: https://github.com/python/cpython/pull/16969

___
Python tracker 

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



[issue38534] Version 3.8.0 has released with a wrong MS KB number reference

2019-10-28 Thread Steve Dower


Steve Dower  added the comment:


New changeset 794616f837c254c68d8384ab48fb78123a3c8a8b by Steve Dower 
(benedwards14) in branch 'master':
bpo-38534: Replace wrong KB number references (GH-16955)
https://github.com/python/cpython/commit/794616f837c254c68d8384ab48fb78123a3c8a8b


--

___
Python tracker 

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



[issue38597] C Extension import limit

2019-10-28 Thread Steve Dower


Steve Dower  added the comment:

There is an implicit cap due to the C runtime (specifically vcruntime140.dll) 
allocating fibre local storage on load, which seems like the one you are 
hitting. However, we discovered this before the first 3.5 release and fixed it.

How are you compiling your packages? Or where are you getting them from?

It's possible that someone else is building and statically linking the C 
runtime, which will cause this, but distutils (and hence CPython) should not be 
doing it by default.

--
components: +Distutils
nosy: +dstufft, eric.araujo

___
Python tracker 

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



[issue38589] Bad target address assigned in Python Manuals shortcut on Python installation

2019-10-28 Thread Steve Dower


Change by Steve Dower :


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

___
Python tracker 

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



[issue38589] Bad target address assigned in Python Manuals shortcut on Python installation

2019-10-28 Thread Steve Dower


Steve Dower  added the comment:

Thanks. Turns out it's a typo that's been around forever, but is really not 
obvious until you install Windows somewhere other than C:\Windows.

Apparently that's far less common than it used to be :)

We'll get it fixed in the next round of releases.

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



[issue38619] [Doc] UUID.hex is lowercase

2019-10-28 Thread Fred Drake


Fred Drake  added the comment:

While I don't know Felipe's use case, I would expect the documentation to be 
clear that the representation won't change in the future so users will know 
that this can be relied on to generate keys into some other persistent 
structure.

--
nosy: +fdrake

___
Python tracker 

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



[issue38453] ntpath.realpath() does not fully resolve relative paths

2019-10-28 Thread Steve Dower


Steve Dower  added the comment:

I also had to special-case "realpath('nul')" to maintain the behaviour that we 
deliberately maintained in another bug, and I think isabs() should always 
return true for "\\?\" prefixed paths (given that join() will promote a "\\?\" 
prefixed path to the root).

--

___
Python tracker 

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



[issue38453] ntpath.realpath() does not fully resolve relative paths

2019-10-28 Thread Steve Dower


Steve Dower  added the comment:

PR 16967 should fix the relative path resolution property, by joining with cwd 
if the original path is unprefixed and not absolute, and then joining with any 
symlink directories if their link is not absolute.

--

___
Python tracker 

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



[issue38453] ntpath.realpath() does not fully resolve relative paths

2019-10-28 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +16494
pull_request: https://github.com/python/cpython/pull/16967

___
Python tracker 

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



[issue37330] open(): remove 'U' mode, deprecated since Python 3.3

2019-10-28 Thread Anthony Sottile


Anthony Sottile  added the comment:

should we backport a documentation change for this? (the deprecatedremoved says 
4.0 currently)

--
nosy: +Anthony Sottile

___
Python tracker 

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



[issue17446] doctest test finder doesnt find line numbers of properties

2019-10-28 Thread daniel hahler


daniel hahler  added the comment:

The PR appears to need a better test according to 
https://github.com/python/cpython/pull/3419#issuecomment-350570083.

--
nosy: +blueyed

___
Python tracker 

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



[issue38519] Internal include files missing on Windows

2019-10-28 Thread miss-islington


miss-islington  added the comment:


New changeset 07eee640cb3a4eaf1df942bc31a891e7517de763 by Miss Skeleton (bot) 
in branch '3.8':
bpo-38519: Internal include files missing on Windows (GH-16921)
https://github.com/python/cpython/commit/07eee640cb3a4eaf1df942bc31a891e7517de763


--
nosy: +miss-islington

___
Python tracker 

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



[issue38611] ElementTree.ParseError does not implement SyntaxError interface as expected

2019-10-28 Thread Brett Cannon


Change by Brett Cannon :


--
title: Bug in traceback.py -> ElementTree.ParseError does not implement 
SyntaxError interface as expected

___
Python tracker 

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



[issue38593] Python 3.7 does not catch infinite recursion for some values of sys.getrecursionlimit()

2019-10-28 Thread Brett Cannon


Brett Cannon  added the comment:

Can you provide a small reproducer? Otherwise the recursion check is mostly 
best effort if you have recursion in C code which never goes out to Python code 
where the recursion check is implemented.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue38618] Why not use refcount of c.c_filename in PyAST_FromNodeObject()

2019-10-28 Thread hai shi


hai shi  added the comment:

> I don't understand the purpose of this issue. The bug tracker is not the 
> right place to ask question. If you think that it's a bug, please explain how 
> to trigger the bug.

Hi, victor. What i want to express is that the refcount operation of filename 
should be same between ast.c and compile.c.

I am not sure i express it clearly. 

If the refcount of filename in ast.c is redundant as Serhiy said, maybe we 
should remove it? 

Hm, If we think it's fine, just keep it, i will close it soon.
And pls forgive me adding a noisy bpo again ;(

--

___
Python tracker 

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



[issue38605] [typing] PEP 563: Postponed evaluation of annotations: enable it by default before Python 4.0

2019-10-28 Thread Barry A. Warsaw


Change by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue38519] Internal include files missing on Windows

2019-10-28 Thread Steve Dower


Steve Dower  added the comment:


New changeset edb172a87296d9359593a23cd9a09f5867ea1f0e by Steve Dower (Zackery 
Spytz) in branch 'master':
bpo-38519: Internal include files missing on Windows (GH-16921)
https://github.com/python/cpython/commit/edb172a87296d9359593a23cd9a09f5867ea1f0e


--

___
Python tracker 

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



[issue38519] Internal include files missing on Windows

2019-10-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16493
pull_request: https://github.com/python/cpython/pull/16966

___
Python tracker 

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



[issue38619] [Doc] UUID.hex is lowercase

2019-10-28 Thread Eric V. Smith


Eric V. Smith  added the comment:

Yes, it's always guaranteed to be lowercase. I don't think it would hurt to 
mention lowercase briefly (like add just one word!).

--
nosy: +eric.smith

___
Python tracker 

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



[issue28029] Replace and empty strings

2019-10-28 Thread STINNER Victor


STINNER Victor  added the comment:

> What result would you expect of `"" in ""` and `"".count("")`?

I don't suggest to change these operator and method:

>>> "" in ""
True
>>> "".count("")
1

--

___
Python tracker 

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



[issue38621] Bad decoding of encoded-words in unstructured email headers

2019-10-28 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +maxking

___
Python tracker 

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



[issue38621] Bad decoding of encoded-words in unstructured email headers

2019-10-28 Thread Fred Drake


Fred Drake  added the comment:

It's worth noting that dealing with this header eventually causes the header 
parser to enter an infinite loop.

--

___
Python tracker 

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



[issue38621] Bad decoding of encoded-words in unstructured email headers

2019-10-28 Thread Fred Drake


New submission from Fred Drake :

I've encountered a problem parsing an email with this Subject: header:

Subject: Be sure to redeem your =?utf-8?Q?$?=201.71 credit card reward
 certificate by the end of the year

email._header_value_parser.get_unstructured defers to get_encoded_word, passing 
the argument

  '=?utf-8?Q?$?=201.71 credit card reward certificate by the end of the year'

get_encoded_word eventually calls email._encoded_words.decode with the argument

  '=?utf-8?Q?$?=201.71 credit card reward certificate by the end of the year?='

This doesn't seem right, but I'm unsure of the syntactic priority of =XX and ?= 
in this case.

The policy for this is email.policy.SMTP + email.policy.strict (not sure if 
that's ideal; I'm retrieving messages from mbox files and over IMAP).

--
assignee: r.david.murray
messages: 355564
nosy: barry, fdrake, r.david.murray
priority: normal
severity: normal
status: open
title: Bad decoding of encoded-words in unstructured email headers

___
Python tracker 

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



[issue38617] Using Py_XINCREF to replace Py_INCREF in PyAST_CompileObject

2019-10-28 Thread hai shi


hai shi  added the comment:

Got it, thanks, Serhiy.

--

___
Python tracker 

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



[issue38336] Remove the __set__ method restriction on data descriptors for attribute lookup precedence

2019-10-28 Thread Géry

Change by Géry :


--
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue28029] Replace and empty strings

2019-10-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What result would you expect of `"" in ""` and `"".count("")`?

--

___
Python tracker 

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



[issue38620] Shell python-config --includes returns the same path twice

2019-10-28 Thread STINNER Victor


New submission from STINNER Victor :

When the shell script implementation of python-config was introduced, 
$PLATINCDIR variable was added:

commit 874211978c8097b8e747c90fa3ff41aacabe340f
Author: d...@python.org 
Date:   Sat Jan 26 11:39:31 2013 +0100

- Issue #16235: Implement python-config as a shell script.

...
+INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
+PLATINCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
...
+--includes)
+echo "$INCDIR $PLATINCDIR"
+;;
+--cflags)
+echo "$INCDIR $PLATINCDIR $BASECFLAGS $CFLAGS $OPT"
+;;
...

But this variable is always equal to $INCDIR: it doesn't seem possible to 
change its value.

What is the purpose of emitting the same path twice?

Example on Fedora 30:

$ file /usr/bin/python3.8-x86_64-config 
/usr/bin/python3.8-x86_64-config: a /usr/bin/sh script, ..

$ /usr/bin/python3.8-x86_64-config --includes
-I/usr/include/python3.8 -I/usr/include/python3.8

=> /usr/include/python3.8 is giving twice

--
components: Build
messages: 355561
nosy: doko, vstinner
priority: normal
severity: normal
status: open
title: Shell python-config --includes returns the same path twice
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



[issue35448] ConfigParser .read() - handling of nonexistent files

2019-10-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> There is a use case of this (which some of tools depends) about checking if 
> configuration exists and if not, raising an error. Now, they can solve this 
> by just adding check_exist argument.

No, it can be solved by using open() and read_file(). It can also be solved by 
checking the result of read(), as Victor suggested. Your proposition adds third 
way, but unlike to the first two it could be used only in new Python versions.

> Can you give an example of how this feature can/could break existing code?

You pass a list containing user configuration path, system-wide configuration 
path, and default configuration path (it can contain also per-directory 
configuration path). At first run of your program there is no user 
configuration file.

> For me, a better option would be to be able to pass an open file to 
> configparser. So the caller can decide how to handle the open() error.

There is the read_file() method which accept an open file.

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



[issue37948] get_type_hints fails if there are un-annotated fields in a dataclass

2019-10-28 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'm not sure what can be done with this. The problem is that the decorator 
doesn't know what's in the caller's namespace. The type being added is 
"typing.Any". If the caller doesn't import typing, then get_type_hints will 
fail (as demonstrated here).

The only thing I can think of is using a type that's in builtins. "object" 
springs to mine, but of course that's semantically incorrect.

Or, maybe I could use "dataclasses.sys.modules['typing'].Any". I don't 
currently import sys (I don't think), but this should be a cheap import. Then 
if typing.get_type_hints() is called, we know typing will have already been 
importing.

But what if "dataclasses" isn't in the caller's namespace? I guess if I could 
find some way to navigate to sys.modules from __builtins__, that would largely 
work, absent playing games with builtins.

--

___
Python tracker 

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



[issue28029] Replace and empty strings

2019-10-28 Thread STINNER Victor


STINNER Victor  added the comment:

Well, in fact, I would expect that "".replace(...) would always return "": for 
any argument passed to replace().

--

___
Python tracker 

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



[issue35448] ConfigParser .read() - handling of nonexistent files

2019-10-28 Thread STINNER Victor


STINNER Victor  added the comment:

> I would expect that this basic usage is very popular. If the file doesn't 
> exist, the normal usage pattern fails in a confusing way: (...)

Well, the configparser is well defined. As you wrote: "If a file named in 
filenames cannot be opened, that file will be ignored."

You can check if the file exists or not by checking read() result:

"read(): (...) returning a list of filenames which were successfully parsed."
https://docs.python.org/dev/library/configparser.html#configparser.ConfigParser.read

I suggest to close this issue as "not a bug".

--

For me, a better option would be to be able to pass an open file to 
configparser. So the caller can decide how to handle the open() error.

--
nosy: +vstinner

___
Python tracker 

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



[issue28029] Replace and empty strings

2019-10-28 Thread STINNER Victor


STINNER Victor  added the comment:

The current behavior is really surprising.

>>> "".replace("", "|")
'|'
>>> "".replace("", "|", -1)
'|'

vs

>>> "".replace("", "|", 0)
''
>>> "".replace("", "|", 1)
''
>>> "".replace("", "|", 1000)
''

I always expect "|".

---

This behavior makes sense to me:

>>> "abc".replace("", "|")
'|a|b|c|'
>>> "abc".replace("", "|", -1)
'|a|b|c|'
>>> "abc".replace("", "|", 0)
'abc'
>>> "abc".replace("", "|", 1)
'|abc'
>>> "abc".replace("", "|", 100)
'|a|b|c|'

--

___
Python tracker 

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



  1   2   >