[issue35647] Cookie path check returns incorrect results

2019-01-03 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

I came across the issue during https://bugs.python.org/issue35121#msg332583 . I 
think this can be dealt as a separate issue not blocking the original report. I 
am classifying it as security but can be reclassified as a bug fix given the 
section on weak confidentiality in RFC 6265. I have a fix implemented at 
https://github.com/tirkarthi/cpython/tree/bpo35121-cookie-path.

Report : 

I have come across another behavior change between path checks while using the 
cookie jar implementation available in Python. This is related to incorrect 
cookie validation but with respect to path. I observed the following difference 
: 

1. Make a request to "/" that sets a cookie with "path=/any"
2. Make a request to "/any" and the set cookie is passed since the path matches
3. Make a request to "/anybad" and cookie with "path=/any" is also passed too.

On using golang stdlib implementation of cookiejar the cookie "path=/any" is 
not passed when a request to "/anybad" is made. So I checked with RFC 6265 
where the path match check is defined in section-5.1.4 . RFC 6265 also 
obsoletes RFC 2965 upon which cookiejar is based I hope since original 
implementation of cookiejar is from 2004 and RFC 6265 was standardized later. 
So I think it's good to enforce RFC 6265 since RFC 2965 is obsolete at least in 
Python 3.8 unless this is considered as a security issue. I think this is a 
security issue. The current implementation can potentially cause cookies to be 
sent to incorrect paths in the same domain that share the same prefix. This is 
a behavior change with more strict checks but I could see no tests failing with 
RFC 6265 implementation too.

RFC 2965 also gives a loose definition of path-match without mentioning about / 
check in the paths based on which Python implementation is based as a simple 
prefix match.

> For two strings that represent paths, P1 and P2, P1 path-matches P2
> if P2 is a prefix of P1 (including the case where P1 and P2 string-
> compare equal).  Thus, the string /tec/waldo path-matches /tec.

RFC 6265 path-match definition : 
https://tools.ietf.org/html/rfc6265#section-5.1.4

   A request-path path-matches a given cookie-path if at least one of
   the following conditions holds:

   o  The cookie-path and the request-path are identical.

   o  The cookie-path is a prefix of the request-path, and the last
  character of the cookie-path is %x2F ("/").

   o  The cookie-path is a prefix of the request-path, and the first
  character of the request-path that is not included in the cookie-
  path is a %x2F ("/") character.

The current implementation in cookiejar is as below : 

def path_return_ok(self, path, request):
_debug("- checking cookie path=%s", path)
req_path = request_path(request)
if not req_path.startswith(path):
_debug("  %s does not path-match %s", req_path, path)
return False
return True

Translating the RFC 6265 steps (a literal translation of go implementation) 
would have something like below and no tests fail on master. So the python 
implementation goes in line with the RFC not passing cookies of "path=/any" to 
/anybody

def path_return_ok(self, path, request):
req_path = request_path(request)
if req_path == path:
return True
elif req_path.startswith(path) and ((path.endswith("/") or 
req_path[len(path)] == "/")):
return True

return False


The golang implementation is as below which is a literal translation of RFC 
6265 steps at 
https://github.com/golang/go/blob/50bd1c4d4eb4fac8ddeb5f063c099daccfb71b26/src/net/http/cookiejar/jar.go#L130

// pathMatch implements "path-match" according to RFC 6265 section 5.1.4.
func (e *entry) pathMatch(requestPath string) bool {
if requestPath == e.Path {
return true
}
if strings.HasPrefix(requestPath, e.Path) {
if e.Path[len(e.Path)-1] == '/' {
return true // The "/any/" matches "/any/path" case.
} else if requestPath[len(e.Path)] == '/' {
return true // The "/any" matches "/any/path" case.
}
}
return false
}


RFC 6265 on weak confidentiality 
(https://tools.ietf.org/html/rfc6265#section-8.5)

   Cookies do not always provide isolation by path.  Although the
   network-level protocol does not send cookies stored for one path to
   another, some user agents expose cookies via non-HTTP APIs, such as
   HTML's document.cookie API.  Because some of these user agents (e.g.,
   web browsers) do not isolate resources received from different paths,
   a resource retrieved from one path might be able to access cookies
   stored for another path.

--
components: Library (Lib)
messages: 332919
nosy: martin.panter, ned.deily, orsenthil, serhiy.storchaka, xtreak
priority: normal
severity: normal
status: open
title: Cookie path check returns incorrect results
type:

[issue35121] Cookie domain check returns incorrect results

2019-01-03 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I have opened issue35647 for path related checks as a separate report.

--

___
Python tracker 

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



[issue35646] python -v writes to stderr

2019-01-03 Thread Deepak Joshi


Deepak Joshi  added the comment:

Hello,

-V and --version both write to stderr not stdout.

On Thu, 3 Jan 2019, 1:29 pm Eric V. Smith 
> Eric V. Smith  added the comment:
>
> -v writes to stderr, so this is the expected behavior. Although maybe this
> could be better documented.
>
> See issue 18338, where this was briefly discussed and a change was
> rejected.
>
> Maybe you're looking for -V (uppercase) or --version, which do write to
> stdout, at least in 3.x. I'm not sure where they write in 2.7, but it's
> much too late to change 2.7's behavior.
>
> I'm going to close this. If you find some of our documentation that says
> -v writes to stdout, then we can reopen this.
>
> This is not a Windows specific error, so I'm modifying the nosy list.
>
> --
> components: +Interpreter Core -Windows, ctypes
> nosy: +eric.smith -paul.moore, steve.dower, tim.golden, zach.ware
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
> title: Subprocess.Popen('python -v',stdout=PIPE,stderr=PIPE,Shell=True)
> gives output in stderr -> python -v writes to stderr
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue35646] python -v writes to stderr

2019-01-03 Thread Eric V. Smith


Eric V. Smith  added the comment:

That's just the way it is with 2.7.

--

___
Python tracker 

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



[issue35648] Add use_srcentry parameter to shutil.copytree()

2019-01-03 Thread flokX


New submission from flokX :

Currently it is decided if to use the srcentry in the copy_function by checking 
if the copy_function is copy() or copy2(). This will fail if the copy_function 
is a modified copy() or copy2() function. To control if the copy_function gets 
a srcentry or srcname parameter, added the use_srcentry parameter.

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 332923
nosy: docs@python, flokX
priority: normal
severity: normal
status: open
title: Add use_srcentry parameter to shutil.copytree()
type: enhancement
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



[issue35648] Add use_srcentry parameter to shutil.copytree()

2019-01-03 Thread flokX


Change by flokX :


--
keywords: +patch, patch, patch
pull_requests: +10832, 10833, 10835
stage:  -> patch review

___
Python tracker 

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



[issue35648] Add use_srcentry parameter to shutil.copytree()

2019-01-03 Thread flokX


Change by flokX :


--
keywords: +patch
pull_requests: +10832
stage:  -> patch review

___
Python tracker 

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



[issue35648] Add use_srcentry parameter to shutil.copytree()

2019-01-03 Thread flokX


Change by flokX :


--
keywords: +patch, patch
pull_requests: +10832, 10833
stage:  -> patch review

___
Python tracker 

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



[issue35648] Add use_srcentry parameter to shutil.copytree()

2019-01-03 Thread flokX


Change by flokX :


--
keywords: +patch, patch, patch, patch
pull_requests: +10832, 10833, 10834, 10835
stage:  -> patch review

___
Python tracker 

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



[issue35646] python -v writes to stderr

2019-01-03 Thread Deepak Joshi


Deepak Joshi  added the comment:

Thank you for the reply Eric.
Thought the behaviour is pretty wierd and opened the issue.

On Thu, 3 Jan 2019, 2:28 pm Eric V. Smith 
> Eric V. Smith  added the comment:
>
> That's just the way it is with 2.7.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue35641] IDLE: calltips not properly formatted for functions without doc-strings

2019-01-03 Thread miss-islington


miss-islington  added the comment:


New changeset 3c83cb7eed4f0e8b9f1cbf39263a2053a2483cb0 by Miss Islington (bot) 
in branch '3.7':
bpo-35641: IDLE - format calltip properly when no docstring (GH-11415)
https://github.com/python/cpython/commit/3c83cb7eed4f0e8b9f1cbf39263a2053a2483cb0


--
nosy: +miss-islington

___
Python tracker 

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



[issue35641] IDLE: calltips not properly formatted for functions without doc-strings

2019-01-03 Thread Tal Einat


Change by Tal Einat :


--
pull_requests:  -10831

___
Python tracker 

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



[issue35641] IDLE: calltips not properly formatted for functions without doc-strings

2019-01-03 Thread Tal Einat


Change by Tal Einat :


--
pull_requests:  -10830, 10831

___
Python tracker 

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



[issue35641] IDLE: calltips not properly formatted for functions without doc-strings

2019-01-03 Thread Tal Einat


Tal Einat  added the comment:

Thanks for the report, Dan!

Thanks for the fix, Emmanuel!

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



[issue35434] Wrong bpo linked in What's New in 3.8

2019-01-03 Thread Yash Aggarwal


Change by Yash Aggarwal :


--
pull_requests:  -10809

___
Python tracker 

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



[issue35434] Wrong bpo linked in What's New in 3.8

2019-01-03 Thread Yash Aggarwal


Change by Yash Aggarwal :


--
pull_requests:  -10811

___
Python tracker 

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



[issue35434] Wrong bpo linked in What's New in 3.8

2019-01-03 Thread Yash Aggarwal


Change by Yash Aggarwal :


--
pull_requests:  -10810

___
Python tracker 

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



[issue31450] Subprocess exceptions re-raised in parent process do not have child_traceback attribute

2019-01-03 Thread Harmandeep Singh


Change by Harmandeep Singh :


--
keywords: +patch
pull_requests: +10836
stage:  -> patch review

___
Python tracker 

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



[issue31450] Subprocess exceptions re-raised in parent process do not have child_traceback attribute

2019-01-03 Thread Harmandeep Singh


Change by Harmandeep Singh :


--
keywords: +patch, patch, patch, patch
pull_requests: +10836, 10837, 10838, 10839
stage:  -> patch review

___
Python tracker 

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



[issue31450] Subprocess exceptions re-raised in parent process do not have child_traceback attribute

2019-01-03 Thread Harmandeep Singh


Change by Harmandeep Singh :


--
keywords: +patch, patch, patch
pull_requests: +10836, 10837, 10838
stage:  -> patch review

___
Python tracker 

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



[issue31450] Subprocess exceptions re-raised in parent process do not have child_traceback attribute

2019-01-03 Thread Harmandeep Singh


Change by Harmandeep Singh :


--
keywords: +patch, patch
pull_requests: +10836, 10837
stage:  -> patch review

___
Python tracker 

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



[issue35645] Alarm usage

2019-01-03 Thread Matthew Barnett


Matthew Barnett  added the comment:

@Steven: The complaint is that the BEL character ('\a') doesn't result in a 
beep when printed.

@Siva: These days, you shouldn't be relying on '\a' because it's not always 
supported. If you want to make a beep, do so with the appropriate function 
call. Ask Google!

--

___
Python tracker 

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



[issue35638] Introduce fixed point locale aware format type for floating point numbers

2019-01-03 Thread Łukasz Stelmach

Łukasz Stelmach  added the comment:

> I haven't looked at this closely yet, but you'll need to at least:
> - add tests that the locale-aware formatting is happening

Done.

> - support decimal
> - make sure it works with complex

Good points. Done. Please note, that there is an inconsistency between 
float/complex/int/_pydecimal(!) and decimal. The former provide only 'n' format 
type and the latter provides 'n' and 'N'. So I implemented 'm' and 'M' for 
decimal and 'm' for _pydecimal.

> (which it probably does, but needs a test)

There are no tests for 'n'. Should I create for both 'm' and 'n'?

> And, I think we'll need to run this through python-ideas first. One thing I 
> expect to come up there: why f and not g?

Because 'g' has been already covered with 'n'.

--

___
Python tracker 

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



[issue35218] decompressing and then re-compressing zipfiles with Python 3 zipfile loses flag_bits

2019-01-03 Thread keeely


keeely  added the comment:

Please note:  I'm unable to fill in your contributor agreement form, so please 
consider the patch an illustrative example.  In any case, the fix is 
pretty-much a one-liner, so shouldn't be a big deal to 're-write'.

I'm disappointed that this has been largely overlooked since I raised it.  It's 
a clear regression in Python3 and represents a show-stopper for people wanting 
to switch from 2->3.  I would imagine you *want* people to migrate to 3, so I'm 
baffled by the response or lack thereof.  Sure, I know everyone is busy but 
this is pretty basic stuff.

--

___
Python tracker 

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



[issue35218] decompressing and then re-compressing zipfiles with Python 3 zipfile loses flag_bits

2019-01-03 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue35638] Introduce fixed point locale aware format type for floating point numbers

2019-01-03 Thread Stefan Krah


Stefan Krah  added the comment:

I think there's another open GitHub issue for this, and yes, probably
it should be discussed on python-ideas, too.

My main concern with 'm' for libmpdec is that I'd like to reserve it
for LC_MONETARY. There was one OS X issue that would have been solved
by adding LC_MONETARY support.

On the other hand perhaps '$' would also be possible for monetary.


So it appears that there might be some bikeshedding about the names
or whether the feature is needed at all.

--
nosy: +skrah

___
Python tracker 

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



[issue35639] Lowecasing Unicode Characters

2019-01-03 Thread Steven D'Aprano


Change by Steven D'Aprano :


--
nosy: +steven.daprano

___
Python tracker 

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



[issue35638] Introduce fixed point locale aware format type for floating point numbers

2019-01-03 Thread Łukasz Stelmach

Łukasz Stelmach  added the comment:

As much as I am open to any suggestions for naming and such (although I think 
'm' together with 'n' are a good supplement for 'f' and 'g'), I really would 
like to introduce a method to format numbers with fixed number of decimal 
digits (it looks good in tables) and with separators from locale.

--

___
Python tracker 

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



[issue35638] Introduce fixed point locale aware format type for floating point numbers

2019-01-03 Thread Stefan Krah


Stefan Krah  added the comment:

For reference, the (one of the?) other GitHub issue(s) is here:

https://github.com/python/cpython/pull/8612


It actually proposes to use LC_MONETARY.

--

___
Python tracker 

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



[issue35431] Add a function for computing binomial coefficients to the math module

2019-01-03 Thread Yash Aggarwal


Yash Aggarwal  added the comment:

I have written the function in the latest patch to work only for positive n. 
Although the definition of combination or nChoosek makes no sense for negative 
n, negative binomial distribution exists and so binomial coefficient is defined 
for negative value of n. So my question is should the function be expanded to 
calculate for negative n or is the function expected to work only in 
combination sense?

--

___
Python tracker 

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



[issue35649] http.client doesn't close. Infinite loop

2019-01-03 Thread skorpeo


New submission from skorpeo :

when testing example from https://docs.python.org/3/library/http.client.html.  
Specifically the chunked example, i.e. while not r1.closed.  Results in 
infinite loop.  

I believe this is because line 398 function def _close_conn(self), should call 
self.close().

--
messages: 332934
nosy: skorpeo
priority: normal
severity: normal
status: open
title: http.client doesn't close.  Infinite loop
versions: Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue35649] http.client doesn't close. Infinite loop

2019-01-03 Thread skorpeo


Change by skorpeo :


--
type:  -> behavior

___
Python tracker 

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



[issue35650] cygwin treats X and X.exe as the same file

2019-01-03 Thread Anthony Sottile


New submission from Anthony Sottile :

>>> with open('f.exe', 'w') as f:
... f.write('hi')
...
>>> with open('f') as f:
... print(f.read())
...
hi


`os.path.exists(...)` and others treat them as the same file as well.  It seems 
the only reliable way to write both files is:

1. write to f.exe
2. write to f.bak
3. move f.bak to f (`os.rename`)

--
components: Windows
messages: 332935
nosy: Anthony Sottile, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: cygwin treats X and X.exe as the same file
type: behavior
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



[issue35650] cygwin treats X and X.exe as the same file

2019-01-03 Thread Anthony Sottile


Anthony Sottile  added the comment:

ah yes, I should include more version information

IEUser@IE11WIN7 ~
$ python --version
Python 2.7.14

IEUser@IE11WIN7 ~
$ python3 --version --version
Python 3.6.4 (default, Jan  7 2018, 17:45:56)
[GCC 6.4.0]


IEUser@IE11WIN7 ~
$ uname -a
CYGWIN_NT-6.1 IE11WIN7 2.11.2(0.329/5/3) 2018-11-08 14:30 i686 Cygwin

--

___
Python tracker 

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



[issue35633] test_eintr fails on AIX since fcntl functions were modified

2019-01-03 Thread Michael Felt


Michael Felt  added the comment:

After reading the PEP I realized it is much simpler. The test is for interrupts 
that occur at a low-level - and not for permission issues. The test is failing 
because there is a permission issue, not a missed interrupt issue. Modifying 
the code to: (see line 510)

  +506  try:
  +507  lock_func(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
  +508  lock_func(f, fcntl.LOCK_UN)
  +509  time.sleep(0.01)
  +510  except (BlockingIOError, PermissionError):
  +511  break
  +512  # the child locked the file just a moment ago for 
'sleep_time' seconds
  +513  # that means that the lock below will block for 
'sleep_time' minus some
  +514  # potential context switch delay
  +515  lock_func(f, fcntl.LOCK_EX)
  +516  dt = time.monotonic() - start_time
  +517  self.assertGreaterEqual(dt, self.sleep_time)
  +518  self.stop_alarm()

fixes this.

--

___
Python tracker 

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



[issue35650] cygwin treats X and X.exe as the same file

2019-01-03 Thread Zachary Ware


Zachary Ware  added the comment:

This sounds like a Cygwin issue; what can Python do about it?

>From a Cygwin shell:

$ ls

$ echo "test.exe" >> test.exe

$ echo "test" >> test

$ cat test
test.exe
test

--

___
Python tracker 

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



[issue35650] cygwin treats X and X.exe as the same file

2019-01-03 Thread Anthony Sottile


Anthony Sottile  added the comment:

hmmm probably nothing in that case -- didn't realize this also happened in the 
cygwin shell.

insanity.

feel free to close!  thanks!

--

___
Python tracker 

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



[issue35650] cygwin treats X and X.exe as the same file

2019-01-03 Thread Zachary Ware


Change by Zachary Ware :


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

___
Python tracker 

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



[issue35633] test_eintr fails on AIX since fcntl functions were modified

2019-01-03 Thread Michael Felt


Change by Michael Felt :


--
keywords: +patch, patch
pull_requests: +10840, 10841
stage:  -> patch review

___
Python tracker 

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



[issue35633] test_eintr fails on AIX since fcntl functions were modified

2019-01-03 Thread Michael Felt


Change by Michael Felt :


--
keywords: +patch
pull_requests: +10840
stage:  -> patch review

___
Python tracker 

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



[issue35189] PEP 475: fnctl functions are not retried if interrupted by a signal (EINTR)

2019-01-03 Thread Michael Felt


Change by Michael Felt :


--
pull_requests: +10842

___
Python tracker 

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



[issue35189] PEP 475: fnctl functions are not retried if interrupted by a signal (EINTR)

2019-01-03 Thread Michael Felt


Change by Michael Felt :


--
pull_requests: +10842, 10843

___
Python tracker 

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



[issue35189] PEP 475: fnctl functions are not retried if interrupted by a signal (EINTR)

2019-01-03 Thread Michael Felt


Change by Michael Felt :


--
pull_requests: +10842, 10843, 10844, 10845

___
Python tracker 

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



[issue35189] PEP 475: fnctl functions are not retried if interrupted by a signal (EINTR)

2019-01-03 Thread Michael Felt


Change by Michael Felt :


--
pull_requests: +10842, 10843, 10845

___
Python tracker 

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



[issue35651] PEP 257 (active) references PEP 258 (rejected) as if it were active

2019-01-03 Thread Mark Amery


New submission from Mark Amery :

PEP 257 says:

> Please see PEP 258, "Docutils Design Specification" [2], for a detailed 
> description of attribute and additional docstrings.

But PEP 258 is rejected. It doesn't seem coherent that an active PEP can defer 
some of its details to a rejected PEP - and indeed it makes me unsure how much 
of the surrounding commentary in PEP 257 to treat as active. e.g. should I 
treat the entire concepts of "attribute docstrings" and "additional docstrings" 
as rejected, given the rejection of PEP 258, or are they still part of the 
current spec, given that they're referenced in PEP 257 prior to any mention of 
PEP 258? It's currently completely unclear.

--
assignee: docs@python
components: Documentation
messages: 332940
nosy: ExplodingCabbage, docs@python
priority: normal
severity: normal
status: open
title: PEP 257 (active) references PEP 258 (rejected) as if it were active
versions: Python 2.7, Python 3.4, 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



[issue35633] test_eintr fails on AIX since fcntl functions were modified

2019-01-03 Thread Michael Felt


Change by Michael Felt :


--
components:  -IO

___
Python tracker 

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



[issue35651] PEP 257 (active) references PEP 258 (rejected) as if it were active

2019-01-03 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



[issue35652] Add use_srcentry parameter to shutil.copytree() II

2019-01-03 Thread flokX


New submission from flokX :

Currently it is decided if to use the srcentry in the copy_function by checking 
if the copy_function is copy() or copy2(). This will fail if the copy_function 
is a modified copy() or copy2() function. To control if the copy_function gets 
a srcentry or srcname parameter, added the use_srcentry parameter.

Successor of https://bugs.python.org/issue35648

--
components: Library (Lib)
messages: 332941
nosy: flokX
priority: normal
severity: normal
status: open
title: Add use_srcentry parameter to shutil.copytree() II
type: enhancement
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



[issue35652] Add use_srcentry parameter to shutil.copytree() II

2019-01-03 Thread flokX


Change by flokX :


--
keywords: +patch
pull_requests: +10846
stage:  -> patch review

___
Python tracker 

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



[issue35648] Add use_srcentry parameter to shutil.copytree()

2019-01-03 Thread flokX


flokX  added the comment:

A new PR is started.
See https://bugs.python.org/issue35652 and 
https://github.com/python/cpython/pull/11425

--
nosy:  -docs@python
resolution:  -> later
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



[issue35644] venv doesn't work on Windows when no venvlauncher executable present

2019-01-03 Thread Ray Donnelly


Ray Donnelly  added the comment:

Thanks Steve, the sys.path value from the first comment can be discarded, it 
was running the wrong Python!

The 'old' mechanism (which my patch reverts to) does copy all the necessary 
DLLs already. I released builds with this patch now and venv works fine (tested 
with pyperformance which uses venv).

However, we are more than happy to switch to the venvlauncher method as not 
deviating from upstream unnecessarily is always a good thing!

Do you have any pointers about how to build venvlauncher? I'll try to schedule 
some time for that.

--

___
Python tracker 

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



[issue35605] backported patch requires new sphinx, minimum sphinx version was not bumped

2019-01-03 Thread Anthony Sottile


Anthony Sottile  added the comment:

I also had to update the patch for sphinx.util.status_iterator which was also 
introduced in sphinx 1.6

--

___
Python tracker 

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



[issue31450] Subprocess exceptions re-raised in parent process do not have child_traceback attribute

2019-01-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10847, 10848, 10849

___
Python tracker 

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



[issue31450] Subprocess exceptions re-raised in parent process do not have child_traceback attribute

2019-01-03 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset 47a2fced84605a32b79aa3ebc543533ad1a976a1 by Gregory P. Smith 
(Harmandeep Singh) in branch 'master':
bpo-31450: Remove documentation mentioning that subprocess's child_traceback is 
available with the parent process (GH-11422)
https://github.com/python/cpython/commit/47a2fced84605a32b79aa3ebc543533ad1a976a1


--

___
Python tracker 

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



[issue31450] Subprocess exceptions re-raised in parent process do not have child_traceback attribute

2019-01-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10847

___
Python tracker 

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



[issue31450] Subprocess exceptions re-raised in parent process do not have child_traceback attribute

2019-01-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10847, 10848

___
Python tracker 

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



[issue31450] Subprocess exceptions re-raised in parent process do not have child_traceback attribute

2019-01-03 Thread miss-islington


miss-islington  added the comment:


New changeset 47c035f3efa77a439967776b5b6ba11d010ce466 by Miss Islington (bot) 
in branch '3.7':
bpo-31450: Remove documentation mentioning that subprocess's child_traceback is 
available with the parent process (GH-11422)
https://github.com/python/cpython/commit/47c035f3efa77a439967776b5b6ba11d010ce466


--
nosy: +miss-islington

___
Python tracker 

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



[issue35649] http.client doesn't close. Infinite loop

2019-01-03 Thread Martin Panter

Martin Panter  added the comment:

This was changed in Python 3.2+ in Issue 16723. The response object no longer 
sets the “closed” attribute when it runs out of data; it is only set when the 
“close” method is called. Perhaps the example should be amended so that it 
checks if “read” returned an empty string, rather than checking “closed”.

Another problem with the example is that printing the chunk as a bytes object 
can trigger BytesWarning. I would add a “repr” call to avoid that.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, martin.panter

___
Python tracker 

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



[issue35653] All regular expression match groups are the empty string

2019-01-03 Thread adiba


New submission from adiba :

This is the regular expression: ^(?:(\d*)(\D*))*$
This is the test string: 42AZ
This is the expectation for the match groups: ('42', 'AZ')
This is the actual return value: ('', '')

https://gist.github.com/adiba/791ba943a1102994d43171dc98aaecd0

--
components: Regular Expressions
messages: 332948
nosy: adiba, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: All regular expression match groups are the empty string
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-01-03 Thread Martijn Pieters


New submission from Martijn Pieters :

Currently, the sorting HOWTO at 
https://docs.python.org/3/howto/sorting.html#odd-and-ends contains the text:

> The sort routines are guaranteed to use __lt__() when making comparisons 
> between two objects. So, it is easy to add a standard sort order to a class 
> by defining an __lt__() method

Nowhere else in the Python documentation is this guarantee made, however. That 
sort currently uses __lt__ only is, in my opinion, an implementation detail.

The above advice also goes against the advice PEP 8 gives:

> When implementing ordering operations with rich comparisons, it is best to 
> implement all six operations (__eq__, __ne__, __lt__, __le__, __gt__, __ge__) 
> rather than relying on other code to only exercise a particular comparison.
>
> To minimize the effort involved, the functools.total_ordering() decorator 
> provides a tool to generate missing comparison methods.

The 'guarantee' seems to have been copied verbatim from the Wiki version of the 
HOWTO in 
https://github.com/python/cpython/commit/0fe095e87f727f4a19b6cbfd718d51935a888740,
 where that part of the Wiki page was added by an anonymous user in revision 44 
to the page: 
https://wiki.python.org/moin/HowTo/Sorting?action=diff&rev1=43&rev2=44

Can this be removed from the HOWTO?

--
assignee: docs@python
components: Documentation
messages: 332949
nosy: docs@python, mjpieters, rhettinger
priority: normal
severity: normal
status: open
title: Remove 'guarantee' that sorting only relies on __lt__ from sorting howto
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



[issue35649] http.client doesn't close. Infinite loop

2019-01-03 Thread skorpeo

skorpeo  added the comment:

Ha, ok that would explain it.  Yes, I think it would indeed be helpful to
update the example, but then again I guess leaving it as is may be a good
way to find out if people are reading the docs.

On Thu, Jan 3, 2019 at 10:21 PM Martin Panter 
wrote:

>
> Martin Panter  added the comment:
>
> This was changed in Python 3.2+ in Issue 16723. The response object no
> longer sets the “closed” attribute when it runs out of data; it is only set
> when the “close” method is called. Perhaps the example should be amended so
> that it checks if “read” returned an empty string, rather than checking
> “closed”.
>
> Another problem with the example is that printing the chunk as a bytes
> object can trigger BytesWarning. I would add a “repr” call to avoid that.
>
> --
> assignee:  -> docs@python
> components: +Documentation
> nosy: +docs@python, martin.panter
>
> ___
> Python tracker 
> 
> ___
>

--
title: http.client doesn't close.  Infinite loop -> http.client doesn't close. 
Infinite loop

___
Python tracker 

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



[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-01-03 Thread Tim Peters


Tim Peters  added the comment:

I don't know that the language needs to define this, but sticking to __lt__ was 
a wholly deliberate design decision for CPython.

--
nosy: +tim.peters

___
Python tracker 

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



[issue35644] venv doesn't work on Windows when no venvlauncher executable present

2019-01-03 Thread Steve Dower


Steve Dower  added the comment:

It should just build directly from venv[w]launcher.vcxproj, though you'll need 
to rename venv[w]launcher.exe to python[w].exe (otherwise they'd conflict in 
the build directory).

--

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2019-01-03 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests: +10850, 10851

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2019-01-03 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests: +10850, 10851, 10852

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2019-01-03 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests: +10850

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2019-01-03 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Terry,

I just saw your note about waiting to split this into a Window and Frame class, 
which was after I had already gotten the PR ready.  I've been mostly offline 
for the past few days, so I had been working on those changes locally with the 
intent of pushing them once I was back online.  I understand if it's not a 
priority to review.  My main goal in splitting them was more for readability 
rather than for being able to add it to a Tabbed window.  As a follow up to 
this refactor, I had hoped to split the Basic and Advanced frames into their 
own tabs, mostly to clean up the create_widgets and to organize the supporting 
functions.

Anyway, PR11427 refactors the main frame from the window.

--

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2019-01-03 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests:  -10852

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2019-01-03 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests:  -10851

___
Python tracker 

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



[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-01-03 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> That sort currently uses __lt__ only is, in my opinion, an implementation 
> detail.

Its only an implementation detail until the language specification defines it 
as a guarantee of the language. Then it becomes part of the sorting API.

Personally, I think it is a nice feature that sorting works for objects which 
define only __lt__, and it sounds like Tim is happy for that to be part of the 
sort API.

This is documented under list.sort() but not sorted():

https://docs.python.org/3/library/stdtypes.html#list.sort

https://docs.python.org/3/library/functions.html#sorted

Rather than removing it from the HOWTO, I would rather document that fact under 
sorted() as well.

If you still want to argue that we should not document this as a language 
guarantee, for the sake of other implementations such as Jython and IronPython, 
you should raise it on Python-Dev. It would probably help if you had other 
implementation maintainers state that this was a burden on them.

For what it is worth, it seems that Jython 2.5 supports this feature too.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue35312] lib2to3.pgen2.parse.ParseError is not roundtrip pickleable

2019-01-03 Thread Anthony Sottile


Anthony Sottile  added the comment:

Looks like this was merged and can be marked as resolved -- should this be 
backported to 3.7?

--

___
Python tracker 

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



[issue35653] All regular expression match groups are the empty string

2019-01-03 Thread Matthew Barnett


Matthew Barnett  added the comment:

Look at the spans of the groups:

>>> import re
>>> re.search(r'^(?:(\d*)(\D*))*$', "42AZ").span(1)
(4, 4)
>>> re.search(r'^(?:(\d*)(\D*))*$', "42AZ").span(2)
(4, 4)

They're telling you that the groups are matching twice (because of the outer 
*). The first time, they match ('42', 'AZ'); the second time, they match ('', 
'') at the end of the string.

Not a bug.

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



[issue35431] Add a function for computing binomial coefficients to the math module

2019-01-03 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> should the function be expanded to calculate for negative 
> n or is the function expected to work only in combination sense?

If this were my design, I would offer both but in separate functions:

def comb(n, k):
if n < 0: raise ValueError
return bincoeff(n, k)

def bincoeff(n, k):
if n < 0:
return (-1)**k * bincoeff(n+k+1, k)
else:
# implementation here...

I believe we agreed earlier that supporting non-integers was not 
necessary.

Are you also providing a perm(n, k) function?

--

___
Python tracker 

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



[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-01-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I also prefer to leave this as is.  FWIW, heapq and bisect are also 
deliberately based on __lt__.  The PEP 8 advice (something I wrote) is 
primarily about making code less fragile and avoiding surprising behavior.

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



[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-01-03 Thread Tim Peters


Tim Peters  added the comment:

Steven, thanks for noticing the docs!  I was surprised to hear it wasn't 
documented, but not surprised enough to check myself ;-)

This decision was suggested by me, and endorsed by Guido, when designing 
timsort looking ahead to Python 3, where __cmp__ was going to vanish.  The 
convenience of needing to add only a single method to support a custom sort 
order is considerable.

Since it's working as designed and dccumented, and I know for certain that code 
in the wild relises on it, I'm inclined to reject this report.  However, rather 
than add more words to `sorted()`, I'd suggest removing words from `sorted()`, 
pointing instead to the `.sort()` docs for all specification of `sorted()`'s 
sorting behavior.

--

___
Python tracker 

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



[issue35431] Add a function for computing binomial coefficients to the math module

2019-01-03 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> return (-1)**k * bincoeff(n+k+1, k)

Oops, that's meant to be n+k-1.

--

___
Python tracker 

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



[issue35198] Build issue while compiling cpp files in AIX

2019-01-03 Thread Kevin


Kevin  added the comment:

Just a friendly ping that there's a PR for this bug waiting to be reviewed.

--
nosy: +kadler

___
Python tracker 

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



[issue35545] asyncio.base_events.create_connection doesn't handle scoped IPv6 addresses

2019-01-03 Thread twisteroid ambassador


twisteroid ambassador  added the comment:

Hi Emmanuel,

Are you referring to my PR 11403? I don't see where IPv6 uses separate 
parameters.

--

___
Python tracker 

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