[issue39187] urllib.robotparser does not respect the longest match for the rule

2020-01-01 Thread Andre Burgaud


Andre Burgaud  added the comment:

During testing identified a related issue that is fixed by the same sort 
function implemented to address the longest match rule.

This related problem also addressed by this change takes into account the 
situation when 2 equivalent rules (same path for allow and disallow) are found 
in the robotstxt. In such a situation allow should be used: 
https://tools.ietf.org/html/draft-koster-rep-00#section-2.2.2

--

___
Python tracker 

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



[issue36051] Drop the GIL during large bytes.join operations?

2020-01-01 Thread Inada Naoki


Inada Naoki  added the comment:

> In the single-threaded case, the benchmark seems to show that for 64K+, 
> performance is improved by dropping the GIL (which I'm guessing must be 
> statistical noise, since there shouldn't be anything contending for it), 
> which is my reasoning behind the 65536 threshold.

Yes, single-threaded case shouldn't affected by this change.  Dropping GIL is 
just a very little overhead.

So you need to focus on multi-threaded case when considering threshold.
As far as seeing your result, 65536 threshold seems too small.
See 512*8192 case.  It shows 1479->980 regression.
But I don't think your script shows real performance.

I updated your patch, and I saw small improvement on 512K and significant 
improvement on 1M.

--
Added file: https://bugs.python.org/file48816/benchjoin2.py

___
Python tracker 

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



[issue39187] urllib.robotparser does not respect the longest match for the rule

2020-01-01 Thread Andre Burgaud


Change by Andre Burgaud :


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

___
Python tracker 

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



[issue16399] argparse: append action with default list adds to list instead of overriding

2020-01-01 Thread hai shi


Change by hai shi :


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

___
Python tracker 

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



[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api

2020-01-01 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
versions: +Python 3.9 -Python 3.7

___
Python tracker 

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



[issue39187] urllib.robotparser does not respect the longest match for the rule

2020-01-01 Thread Andre Burgaud


New submission from Andre Burgaud :

As per the current Robots Exclusion Protocol internet draft, 
https://tools.ietf.org/html/draft-koster-rep-00#section-3.2. a robot should 
apply the rules respecting the longest match.

urllib.robotparser relies on the order of the rules in the robots.txt file. 
Here is the section in the specs:

===
3.2.  Longest Match

   The following example shows that in the case of a two rules, the
   longest one MUST be used for matching.  In the following case,
   /example/page/disallowed.gif MUST be used for the URI
   example.com/example/page/disallow.gif .

   
   User-Agent : foobot
   Allow : /example/page/
   Disallow : /example/page/disallowed.gif

===

I'm attaching a simple test file "test_robot.py"

--
components: Library (Lib)
files: test_robot.py
messages: 359181
nosy: gallicrooster
priority: normal
severity: normal
status: open
title: urllib.robotparser does not respect the longest match for the rule
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file48815/test_robot.py

___
Python tracker 

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



[issue35457] robotparser reads empty robots.txt file as "all denied"

2020-01-01 Thread Andre Burgaud


Andre Burgaud  added the comment:

Hi,

Is this ticket still relevant for Python 3.8?

While running some tests with an empty robotstxt file I realized that it was 
returning "ALLOWED" for any path (as per the current draft of the Robots 
Exclusion Protocol: 
https://tools.ietf.org/html/draft-koster-rep-00#section-2.2.1 ")

Code:

from urllib import robotparser

robots_url = "file:///tmp/empty.txt"

rp = robotparser.RobotFileParser()
print(robots_url)
rp.set_url(robots_url)
rp.read()
print( "fetch /", rp.can_fetch(useragent = "*", url = "/"))
print( "fetch /admin", rp.can_fetch(useragent = "*", url = "/admin"))

Output:

$ cat /tmp/empty.txt
$ python -V
Python 3.8.1
$ python test_robot3.py
file:///tmp/empty.txt
fetch / True
fetch /admin True

--
nosy: +gallicrooster

___
Python tracker 

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



[issue39186] Windows installer instructions refer to mercurial

2020-01-01 Thread anthony shaw


New submission from anthony shaw :

Very minor, but the instructions in Tools/msi/readme.txt tell the user to 
ensure hg.exe is in PATH, but the scripts use Git.

--
components: Windows
messages: 359179
nosy: anthonypjshaw, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Windows installer instructions refer to mercurial

___
Python tracker 

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



[issue39186] Windows installer instructions refer to mercurial

2020-01-01 Thread anthony shaw


Change by anthony shaw :


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

___
Python tracker 

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



[issue39185] Add quiet and detailed verbosity levels to build.bat

2020-01-01 Thread anthony shaw


Change by anthony shaw :


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

___
Python tracker 

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



[issue39185] Add quiet and detailed verbosity levels to build.bat

2020-01-01 Thread anthony shaw


New submission from anthony shaw :

The build.bat script (windows build) has a flag for verbose, which sets the 
msbuild verbosity level to normal.
The default level is minimal.

The quiet and detailed levels would also be useful for development.

--
components: Windows
messages: 359178
nosy: anthonypjshaw, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Add quiet and detailed verbosity levels to build.bat
type: enhancement

___
Python tracker 

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



[issue15795] Zipfile.extractall does not preserve file permissions

2020-01-01 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +17223
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/17790

___
Python tracker 

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



[issue39184] Many command execution functions are not raising auditing events

2020-01-01 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +steve.dower

___
Python tracker 

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



[issue39184] Many command execution functions are not raising auditing events

2020-01-01 Thread Saiyang Gou


New submission from Saiyang Gou :

Similar to `os.system` (which is already raising auditing event), the following 
functions are also capable of command execution, so they also need auditing:

- os.execl
- os.execle
- os.execlp
- os.execlpe
- os.execv
- os.execve
- os.execvp
- os.execvpe
- os.posix_spawn
- os.posix_spawnp
- os.spawnl
- os.spawnle
- os.spawnlp
- os.spawnlpe
- os.spawnv
- os.spawnve
- os.spawnvp
- os.spawnvpe
- os.startfile
- pty.spawn

By the way, since `os.listdir`, `shutil.copytree` and `shutil.rmtree` are 
already being audited, is it necessary to audit file operations in the `os` 
module like `os.remove`?

--
messages: 359177
nosy: Saiyang Gou
priority: normal
severity: normal
status: open
title: Many command execution functions are not raising auditing events
type: security
versions: Python 3.8, Python 3.9

___
Python tracker 

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



[issue27973] urllib.urlretrieve() fails on second ftp transfer

2020-01-01 Thread David Bolen


David Bolen  added the comment:

The issue appears to be the temporary flag (O_TEMPORARY) that is used under 
Windows with delete on close temporary files.  That appears to prevent any 
separate access to the file by anyone else including obtaining another 
reference in the same process:

>>> temp = tempfile.NamedTemporaryFile()
>>> temp, temp.name
(', mode 'w+b' at 0x017958E8>, 'd:\\temp\\tmp44kugh')
>>> other = open(temp.name, 'r')
Traceback (most recent call last):
  File "", line 1, in 
IOError: [Errno 13] Permission denied: 'd:\\temp\\tmp44kugh'

Changing the mode (PR 17774) of the temporary file has no effect.  Setting 
delete=False will work, but would defeat the point of using NamedTemporaryFile 
for the cleanup.

I don't see any way to have both auto-delete and the ability to write 
separately to a file under Windows with NamedTemporaryFile.

Perhaps instead use test.support.temp_dir for the overall test, and let it take 
care of the iteration temp files when cleaning up the entire directory?  
Something like:

with test_support.temp_dir() as td:
for i in range(self.NUM_FTP_RETRIEVES):
urllib.FancyURLopener().retrieve(self.FTP_TEST_FILE, 
os.path.join(td, str(i)))

That seems to work fine under Windows.

--
nosy: +db3l

___
Python tracker 

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



[issue39183] Text divided in two strings due to wrong formatting

2020-01-01 Thread miss-islington


miss-islington  added the comment:


New changeset 6bf382ac9a07f42c6f91f35a7f0df4c63e35a8a7 by Miss Islington (bot) 
in branch '3.8':
bpo-39183: Fix formatting in library/ensurepip (GH-17787)
https://github.com/python/cpython/commit/6bf382ac9a07f42c6f91f35a7f0df4c63e35a8a7


--

___
Python tracker 

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



[issue39183] Text divided in two strings due to wrong formatting

2020-01-01 Thread miss-islington


miss-islington  added the comment:


New changeset 3959638ba1b1e25c25a2da880aba78fd53dd947f by Miss Islington (bot) 
in branch '3.7':
bpo-39183: Fix formatting in library/ensurepip (GH-17787)
https://github.com/python/cpython/commit/3959638ba1b1e25c25a2da880aba78fd53dd947f


--

___
Python tracker 

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



[issue39183] Text divided in two strings due to wrong formatting

2020-01-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17221
pull_request: https://github.com/python/cpython/pull/17788

___
Python tracker 

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



[issue39183] Text divided in two strings due to wrong formatting

2020-01-01 Thread miss-islington


miss-islington  added the comment:


New changeset 149175c6dfc8455023e4335575f3fe3d606729f9 by Miss Islington (bot) 
(Rafael Fontenelle) in branch 'master':
bpo-39183: Fix formatting in library/ensurepip (GH-17787)
https://github.com/python/cpython/commit/149175c6dfc8455023e4335575f3fe3d606729f9


--
nosy: +miss-islington

___
Python tracker 

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



[issue39183] Text divided in two strings due to wrong formatting

2020-01-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17222
pull_request: https://github.com/python/cpython/pull/17789

___
Python tracker 

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



[issue13601] sys.stderr should be line-buffered when stderr is not a TTY

2020-01-01 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Jendrik, thank you for fixing this!

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



[issue13601] sys.stderr should be line-buffered when stderr is not a TTY

2020-01-01 Thread Antoine Pitrou


Antoine Pitrou  added the comment:


New changeset 5b9077134cd0535f21905d5f5195847526cac99c by Antoine Pitrou 
(Jendrik Seipp) in branch 'master':
bpo-13601: always use line-buffering for sys.stderr (GH-17646)
https://github.com/python/cpython/commit/5b9077134cd0535f21905d5f5195847526cac99c


--

___
Python tracker 

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



[issue39183] Text divided in two strings due to wrong formatting

2020-01-01 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue39183] Text divided in two strings due to wrong formatting

2020-01-01 Thread Rafael Fontenelle


New submission from Rafael Fontenelle :

When translating Python docs, the 'library/ensurepip' module [1] has an bullet 
list where one item's text is split in two due to a simple extra whitespace 
character. This causes two separated translations strings

"``--default-pip``: if a \"default pip\" installation is requested, the"

and

"``pip`` script will be installed in addition to the two regular scripts."

, which clearly should be a single one.

Its effect can be seen also in the resulting documentation, where these strings 
are shown in different lines even when there are enough space in the browser 
window to should it all.

Solution is to remove the extra space and formatting is good again.

[1] https://docs.python.org/3/library/ensurepip.html

--
assignee: docs@python
components: Documentation
messages: 359170
nosy: docs@python, rffontenelle
priority: normal
severity: normal
status: open
title: Text divided in two strings due to wrong formatting
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



[issue38879] Reordered error checking in PyArena_New().

2020-01-01 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I'm rejecting this, as explained on the Github PR.

--
nosy: +pitrou
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue39142] logging.config.dictConfig will convert namedtuple to ConvertingTuple

2020-01-01 Thread Vinay Sajip


Change by Vinay Sajip :


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



[issue39142] logging.config.dictConfig will convert namedtuple to ConvertingTuple

2020-01-01 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset 0e0e4acaabdcf8efb60cf75f08301022ac4422a4 by Vinay Sajip (Miss 
Islington (bot)) in branch '3.7':
bpo-39142: Avoid converting namedtuple instances to ConvertingTuple. (GH-17773) 
(GH-17786)
https://github.com/python/cpython/commit/0e0e4acaabdcf8efb60cf75f08301022ac4422a4


--

___
Python tracker 

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



[issue39142] logging.config.dictConfig will convert namedtuple to ConvertingTuple

2020-01-01 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset 1d5a7e5694bd9104f56f4f28357c2d13afd58a29 by Vinay Sajip (Miss 
Islington (bot)) in branch '3.8':
bpo-39142: Avoid converting namedtuple instances to ConvertingTuple. (GH-17773) 
(GH-17785)
https://github.com/python/cpython/commit/1d5a7e5694bd9104f56f4f28357c2d13afd58a29


--

___
Python tracker 

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



[issue39142] logging.config.dictConfig will convert namedtuple to ConvertingTuple

2020-01-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17217
pull_request: https://github.com/python/cpython/pull/17785

___
Python tracker 

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



[issue39142] logging.config.dictConfig will convert namedtuple to ConvertingTuple

2020-01-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17218
pull_request: https://github.com/python/cpython/pull/17786

___
Python tracker 

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



[issue39142] logging.config.dictConfig will convert namedtuple to ConvertingTuple

2020-01-01 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset 46abfc1416ff8e450999611ef8f231ff871ab133 by Vinay Sajip in branch 
'master':
bpo-39142: Avoid converting namedtuple instances to ConvertingTuple. (GH-17773)
https://github.com/python/cpython/commit/46abfc1416ff8e450999611ef8f231ff871ab133


--

___
Python tracker 

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



[issue39182] sys.addaudithook(hook) loops indefinitely on mismatch for hook

2020-01-01 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +christian.heimes, steve.dower

___
Python tracker 

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



[issue39134] can't construct dataclass as ABC (or runtime check as data protocol)

2020-01-01 Thread Guido van Rossum


Guido van Rossum  added the comment:

Try adding a setter to the base class method.

--

___
Python tracker 

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



[issue39182] sys.addaudithook(hook) loops indefinitely on mismatch for hook

2020-01-01 Thread Dutcho


New submission from Dutcho :

When hook is not a compatible callable, addaudithook() will loop forever. At 
the minimum, a check for being callable should be executed. Preferably, a 
non-compatible (i.e. signature != [[str, tuple], Any]) hook callable should 
also be detected.

>py
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.addaudithook(0)
error=10
Exception ignored in audit hook:
TypeError: 'int' object is not callable
  File "", line 0
SyntaxError: unknown parsing error
error=10
Exception ignored in audit hook:
TypeError: 'int' object is not callable
  File "", line 0
SyntaxError: unknown parsing error
error=10
Exception ignored in audit hook:
TypeError: 'int' object is not callable
  File "", line 0
SyntaxError: unknown parsing error
... etc. ...

--
messages: 359164
nosy: Dutcho
priority: normal
severity: normal
status: open
title: sys.addaudithook(hook) loops indefinitely on mismatch for hook
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



[issue39134] can't construct dataclass as ABC (or runtime check as data protocol)

2020-01-01 Thread Alexander Hirner


Alexander Hirner  added the comment:

Dropping ABCMeta stops at instantiation. This should be in the dataclass code 
that's been generated.

  File "", line 2, in __init__
AttributeError: can't set attribute


Repro:
```
class QuasiABC:
@property
@abstractmethod
def x(self) -> int: ...

@dataclass(frozen=True)
class E(QuasiABC):
x: int

E(10)
```

Interestingly, frozen=False is giving the same error.

--

___
Python tracker 

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



[issue39181] Add `os.makedirs()` as `Path.mkdir()` equivalent in correspondence table

2020-01-01 Thread jack1142


New submission from jack1142 :

https://github.com/python/cpython/blob/3.7/Doc/library/pathlib.rst#correspondence-to-tools-in-the-modos-module

The table mapping `os` functions to `Path`'s equivalents is missing 
`os.makedirs` in the row with `Path.mkdir()` and they are both equivalent when 
`Path.mkdir()` is used with `parents=True` kwarg.

I can make a PR once this gets triaged, I'm not sure if this doc improvement 
should only be made to master branch or also 3.7/3.8 so let me know about that 
too, thanks.

--
assignee: docs@python
components: Documentation
messages: 359162
nosy: docs@python, jack1142
priority: normal
severity: normal
status: open
title: Add `os.makedirs()` as `Path.mkdir()` equivalent in correspondence table
type: enhancement
versions: Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue39178] Should we make dict not accept a sequence of sets?

2020-01-01 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

"should dict preemptively make sure it doesn't accept a sequence of sets"

No. The person on StackOverflow made a mistake in their code: they used an 
unordered data structure (set) instead of an ordered data structure (tuple):

dict({i,j} for i,j in enumerate(lst))

It is a waste of time to slow down the dict constructor to check for something 
so unusual as this. Everyone will pay the cost of the checks and virtually 
no-one will get any benefit.

I'm closing this as "rejected", but if anyone disagrees they can reopen it.

By the way, the best way to initialise a dictionary in this situation is to 
avoid the unnecessary generator expression and just go straight to enumerate:

dict(enumerate(lst))

--
nosy: +steven.daprano
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



[issue39180] Missing getlines func documentation from linecache module

2020-01-01 Thread Khalid Mammadov


Change by Khalid Mammadov :


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

___
Python tracker 

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



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

2020-01-01 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This was discussed recently on the Python-ideas mailing list.

https://mail.python.org/archives/list/python-id...@python.org/thread/M2OZCN5C26YUJJ4EXLIIXHQBGF6IM5GW/#H3GURL35C7AZ3ZBK6CQZGGCISUZ42WDV

I agree with Raymond that this is an education problem. There are occurrences 
of `findall(...)[0]` in real code, but most of this code has not very high 
quality. In all cases re.search() can be used. In some cases the code can be 
rewritten in much more efficient way, using a single regular expression, for 
example:

-   if re.search('^(\w+) (\w+)$', parcel.owner):
- last, first = re.findall( '(\w+) (\w+)',parcel.owner )[0]
-   elif re.search('^(\w+) (\w+) (\w+)$', parcel.owner):
- last, first, middle = re.findall( '(\w+) (\w+) (\w+)',parcel.owner )[0]
-   elif re.search('^(\w+) (\w+)  (\w+)$', parcel.owner):
- last, first = re.findall( '(\w+) (\w+)',parcel.owner )[0]
-   elif re.search('^(\w+) (\w+) (\w+) : (\w+)$', parcel.owner):
- last, first, middle = re.findall( '(\w+) (\w+) (\w+)',parcel.owner )[0]
-   elif re.search('^(\w+) (\w+)  (\w+) (\w+)$', parcel.owner):
- last, first = re.findall( '(\w+) (\w+)',parcel.owner )[0]
-   elif re.search('^(\w+) (\w+) (\w+) : (\w+) (\w+)$', parcel.owner):
- last, first, middle = re.findall( '(\w+) (\w+) (\w+)',parcel.owner )[0]
-   elif re.search('^(\w+) (\w+)  (\w+) (\w+) (\w+)$', parcel.owner):
- last, first = re.findall( '(\w+) (\w+)',parcel.owner )[0]
-   elif re.search('^(\w+) (\w+) (\w+) : (\w+) (\w+) (\w+)$', parcel.owner):
- last, first, middle = re.findall( '(\w+) (\w+) (\w+)', parcel.owner 
)[0]
+   m = re.fullmatch('(\w+) (\w+)(?: (\w+))?(?: (?: \w+){1,3})?', 
parcel.owner)
+   if m:
+ last, first, middle = m.groups()

But even using `findall(...)[0]` is not always so bad, because in many cases 
findall() returns a list containing a single string.

Adding re.findfirst() will not automatically fix all existing code which uses 
`findall(...)[0]`. This is an education problem, you need to teach people to 
use the more appropriate function, and if you can teach about re.findfirst(), 
why can't you teach about re.search()?

--

___
Python tracker 

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



[issue35561] Valgrind reports Syscall param epoll_ctl(event) points to uninitialised byte(s)

2020-01-01 Thread Zackery Spytz


Change by Zackery Spytz :


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



[issue35561] Valgrind reports Syscall param epoll_ctl(event) points to uninitialised byte(s)

2020-01-01 Thread Zackery Spytz


Change by Zackery Spytz :


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

___
Python tracker 

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



[issue39180] Missing getlines func documentation from linecache module

2020-01-01 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

As a note getlines is not exposed via __all__ : 
https://github.com/python/cpython/blob/22424c02e51fab3b62cbe255d0b87d1b55b9a6c3/Lib/linecache.py#L13

--
nosy: +xtreak

___
Python tracker 

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



[issue39179] pandas tz_convert() seems to report incorrect date conversion

2020-01-01 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

This tracker is for issues related to CPython. Unless there is a simple 
reproducer in Python without pandas to illustrate the issues reported I would 
propose closing this as third party. Please follow this up at 
https://github.com/pandas-dev/pandas/

--
nosy: +xtreak

___
Python tracker 

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



[issue39180] Missing getlines func documentation from linecache module

2020-01-01 Thread Khalid Mammadov


Change by Khalid Mammadov :


--
assignee: docs@python
components: Documentation
nosy: docs@python, khalidmammadov
priority: normal
severity: normal
status: open
title: Missing getlines func documentation from linecache module
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



[issue39178] Should we make dict not accept a sequence of sets?

2020-01-01 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This is a very special case. I think it is better to leave it to third-party 
linters.

Actually it is so uncommon, that I have doubts that even linters will want to 
handle it.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue39179] pandas tz_convert() seems to report incorrect date conversion

2020-01-01 Thread seeking.that


New submission from seeking.that :

Hi

python pandas bdate_range tz_convert() seems to have problems as it prints the 
information incorrectly. Please clarity. The python script and the output is 
shown below:

Two issues that can be highlighted here are:
1) Setting the timezone correctly to US/Pacific prints the dates correctly. But 
the conversion causes the date calculations to be incorrect.
2. Minor issue just related to display. Though the API hasn't changed, the last 
call has more information hh-mm-ss-xx-xx which is not there for the rest of the 
calls with same format signature.

Thanks
SK
import pandas as pd

c5 = pd.bdate_range(start='1/1/2018', end = '1/31/2018')
print(c5)
c5 = c5.tz_localize('UTC')
print(c5)
c5 = c5.tz_convert('US/Pacific')
print(c5)
c6 = pd.bdate_range(start='1/1/2018', end = '1/31/2018')
print(c6)
c6 = c6.tz_localize('US/Pacific')
print(c6)
--

DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04',
   '2018-01-05', '2018-01-08', '2018-01-09', '2018-01-10',
   '2018-01-11', '2018-01-12', '2018-01-15', '2018-01-16',
   '2018-01-17', '2018-01-18', '2018-01-19', '2018-01-22',
   '2018-01-23', '2018-01-24', '2018-01-25', '2018-01-26',
   '2018-01-29', '2018-01-30', '2018-01-31'],
  dtype='datetime64[ns]', freq='B')
DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04',
   '2018-01-05', '2018-01-08', '2018-01-09', '2018-01-10',
   '2018-01-11', '2018-01-12', '2018-01-15', '2018-01-16',
   '2018-01-17', '2018-01-18', '2018-01-19', '2018-01-22',
   '2018-01-23', '2018-01-24', '2018-01-25', '2018-01-26',
   '2018-01-29', '2018-01-30', '2018-01-31'],
  dtype='datetime64[ns, UTC]', freq='B')
DatetimeIndex(['2017-12-31', '2018-01-01', '2018-01-02', '2018-01-03',
   '2018-01-04', '2018-01-07', '2018-01-08', '2018-01-09',
   '2018-01-10', '2018-01-11', '2018-01-14', '2018-01-15',
   '2018-01-16', '2018-01-17', '2018-01-18', '2018-01-21',
   '2018-01-22', '2018-01-23', '2018-01-24', '2018-01-25',
   '2018-01-28', '2018-01-29', '2018-01-30'],
  dtype='datetime64[ns, US/Pacific]', freq='B')
DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04',
   '2018-01-05', '2018-01-08', '2018-01-09', '2018-01-10',
   '2018-01-11', '2018-01-12', '2018-01-15', '2018-01-16',
   '2018-01-17', '2018-01-18', '2018-01-19', '2018-01-22',
   '2018-01-23', '2018-01-24', '2018-01-25', '2018-01-26',
   '2018-01-29', '2018-01-30', '2018-01-31'],
  dtype='datetime64[ns]', freq='B')
DatetimeIndex(['2018-01-01 00:00:00-08:00', '2018-01-02 00:00:00-08:00',
   '2018-01-03 00:00:00-08:00', '2018-01-04 00:00:00-08:00',
   '2018-01-05 00:00:00-08:00', '2018-01-08 00:00:00-08:00',
   '2018-01-09 00:00:00-08:00', '2018-01-10 00:00:00-08:00',
   '2018-01-11 00:00:00-08:00', '2018-01-12 00:00:00-08:00',
   '2018-01-15 00:00:00-08:00', '2018-01-16 00:00:00-08:00',
   '2018-01-17 00:00:00-08:00', '2018-01-18 00:00:00-08:00',
   '2018-01-19 00:00:00-08:00', '2018-01-22 00:00:00-08:00',
   '2018-01-23 00:00:00-08:00', '2018-01-24 00:00:00-08:00',
   '2018-01-25 00:00:00-08:00', '2018-01-26 00:00:00-08:00',
   '2018-01-29 00:00:00-08:00', '2018-01-30 00:00:00-08:00',
   '2018-01-31 00:00:00-08:00'],
  dtype='datetime64[ns, US/Pacific]', freq='B')

--
messages: 359156
nosy: Seeking.that
priority: normal
severity: normal
status: open
title: pandas tz_convert() seems to report incorrect date conversion
versions: Python 3.6

___
Python tracker 

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



[issue39178] Should we make dict not accept a sequence of sets?

2020-01-01 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +inada.naoki, rhettinger

___
Python tracker 

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



[issue39178] Should we make dict not accept a sequence of sets?

2020-01-01 Thread Adi


New submission from Adi :

While writing this SO answer (https://stackoverflow.com/a/59552970/1453822) I 
came to think, should dict preemptively make sure it doesn't accept a sequence 
of sets (given that it may lead to wrong output in the good case, and miserably 
fail in the worst case)?

--
messages: 359155
nosy: DeepSpace
priority: normal
severity: normal
status: open
title: Should we make dict not accept a sequence of sets?
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



[issue39166] Python 3.9.0a2 changed how "async for" traces its final iteration

2020-01-01 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

Bisecting points me to fee552669f . I tried compiling latest master with the 
bytecode changes and the behavior is same as reported.

➜  cpython git:(5dcc06f6e0) ./python ../backups/bpo39166.py > 
fee552669f_before.txt
➜  cpython git:(5dcc06f6e0) ✗ git checkout fee552669f   
 
➜  cpython git:(fee552669f) ✗ make -s -j4 > /dev/null 
➜  cpython git:(fee552669f) ✗ ./python ../backups/bpo39166.py > fee552669f.txt  
 
➜  cpython git:(fee552669f) ✗ diff fee552669f.txt fee552669f_before.txt 
1c1
< 3.9.0a1+ (tags/v3.9.0a1-43-gfee552669f:fee552669f, Jan  1 2020, 18:51:56) 
---
> 3.9.0a1+ (tags/v3.9.0a1-42-g5dcc06f6e0:5dcc06f6e0, Jan  1 2020, 18:49:53) 
47d46
< line 33: print(letter)

With master

➜  cpython git:(master) ./python ../backups/bpo39166.py > master.txt
➜  cpython git:(master) ✗ diff fee552669f_before.txt master.txt
1c1
< 3.9.0a1+ (tags/v3.9.0a1-42-g5dcc06f6e0:5dcc06f6e0, Jan  1 2020, 18:49:53) 
---
> 3.9.0a2+ (heads/master:22424c02e5, Jan  1 2020, 18:55:29) 
46a47
> line 33: print(letter)

--
nosy: +serhiy.storchaka, xtreak

___
Python tracker 

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



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

2020-01-01 Thread Juancarlo Añez

Juancarlo Añez  added the comment:

The discussion on python-ideas favored the inclusion of `findfirst()`. At any 
rate, not having a generator version of `findall()` is an important omission.

Another user's search of Github public repositories found that 
`findall(...)[0]` is prevalent. python-ideas agreed that the cause was the 
incompleteness/asymmetry in `re`.

--

___
Python tracker 

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



[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api

2020-01-01 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
pull_requests:  -17214

___
Python tracker 

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



[issue39166] Python 3.9.0a2 changed how "async for" traces its final iteration

2020-01-01 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +asvetlov, yselivanov

___
Python tracker 

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



[issue39175] Funkness with issubset

2020-01-01 Thread Justin Hodder


Justin Hodder  added the comment:

AttributeError: 'tuple' object has no attribute 'issubset'

And it doesn't explain why it works as expected in Brython.

--

___
Python tracker 

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



[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api

2020-01-01 Thread Vinay Sajip


Change by Vinay Sajip :


--
pull_requests: +17214
pull_request: https://github.com/python/cpython/pull/17773

___
Python tracker 

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



[issue39166] Python 3.9.0a2 changed how "async for" traces its final iteration

2020-01-01 Thread Ned Batchelder


Ned Batchelder  added the comment:

I see that you are right, the bytecode is the same in 3.8 and 3.9. 
Nevertheless, the trace has definitely changed.  Using the same program from 
the top of the issue, here are the ends of the traces for a number of Python 
versions.  The extra trace of line 32 appears in 3.9.0a2:


$ for v in 3.6.9 3.7.4 3.8.1 3.9.0a1 3.9.0a2; do printf "\n\n"; 
$(pythonz locate $v) -c "import sys; print(sys.version)"; $(pythonz locate $v) 
/tmp/bpo2.py | tail -10; done


3.6.9 (default, Jul 29 2019, 08:21:55)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.10.44.4)]
line 21: return next(self._it)
exce 21: return next(self._it)
line 22: except StopIteration:
line 23: raise StopAsyncIteration
exce 23: raise StopAsyncIteration
retu 23: raise StopAsyncIteration
exce 31: async for letter in AsyncIteratorWrapper("ab"):
line 33: print(".")
.
retu 33: print(".")


3.7.4 (default, Jul 11 2019, 19:53:42)
[Clang 10.0.0 (clang-1000.10.44.4)]
line 21: return next(self._it)
exce 21: return next(self._it)
line 22: except StopIteration:
line 23: raise StopAsyncIteration
exce 23: raise StopAsyncIteration
retu 23: raise StopAsyncIteration
exce 31: async for letter in AsyncIteratorWrapper("ab"):
line 33: print(".")
.
retu 33: print(".")


3.8.1 (default, Dec 19 2019, 08:38:38)
[Clang 10.0.0 (clang-1000.10.44.4)]
line 21: return next(self._it)
exce 21: return next(self._it)
line 22: except StopIteration:
line 23: raise StopAsyncIteration
exce 23: raise StopAsyncIteration
retu 23: raise StopAsyncIteration
exce 31: async for letter in AsyncIteratorWrapper("ab"):
line 33: print(".")
.
retu 33: print(".")


3.9.0a1 (default, Nov 20 2019, 18:52:14)
[Clang 10.0.0 (clang-1000.10.44.4)]
line 21: return next(self._it)
exce 21: return next(self._it)
line 22: except StopIteration:
line 23: raise StopAsyncIteration
exce 23: raise StopAsyncIteration
retu 23: raise StopAsyncIteration
exce 31: async for letter in AsyncIteratorWrapper("ab"):
line 33: print(".")
.
retu 33: print(".")


3.9.0a2 (default, Dec 19 2019, 08:42:29)
[Clang 10.0.0 (clang-1000.10.44.4)]
exce 21: return next(self._it)
line 22: except StopIteration:
line 23: raise StopAsyncIteration
exce 23: raise StopAsyncIteration
retu 23: raise StopAsyncIteration
exce 31: async for letter in AsyncIteratorWrapper("ab"):
line 32: print(letter)
line 33: print(".")
.
retu 33: print(".")

$

--

___
Python tracker 

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



[issue39166] Python 3.9.0a2 changed how "async for" traces its final iteration

2020-01-01 Thread Mark Shannon


Mark Shannon  added the comment:

Ned, can you confirm that the trace has changed from 3.8 to 3.9?

The bytecode for `doit_async` is identical for 3.8 and 3.9.

--

___
Python tracker 

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



[issue38871] lib2to3 generates invalid code with filter and ternary operator

2020-01-01 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



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

2020-01-01 Thread SilentGhost


SilentGhost  added the comment:

You'd need to elaborate on that. I've been using argparse for years and never 
once had presentational aspects affected by work. So, again, what is the actual 
use case for this?

--

___
Python tracker 

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



[issue39171] Missing default root in tkinter simpledialog.py

2020-01-01 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +gpolo, serhiy.storchaka

___
Python tracker 

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



[issue38750] Solve IPv4 categorisation issues with the ipaddress module

2020-01-01 Thread sam jonas


sam jonas  added the comment:

Hi i am also facing the same issue, please provide a good solution

--
nosy: +samjonas

___
Python tracker 

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