[issue31940] copystat on symlinks fails for alpine -- faulty lchmod implementation?

2017-11-03 Thread Anthony Sottile

New submission from Anthony Sottile :

Fortunately, this can be reproduced with the testsuite:

```
==
ERROR: test_copystat_symlinks (__main__.TestShutil)
--
Traceback (most recent call last):
  File "/usr/lib/python3.6/test/test_shutil.py", line 366, in 
test_copystat_symlinks
os.lchmod(src_link, stat.S_IRWXO)
OSError: [Errno 95] Not supported: '/tmp/tmplfli9msi/baz'

```

My simplest reproduction involves docker:

```dockerfile
FROM alpine
RUN apk update && apk add curl python3

RUN mkdir foo && ln -s /dev/null foo/bar

CMD [ \
"python3", "-c", \
"import shutil; shutil.copytree('foo', 'bar', symlinks=True)" \
]
```

```
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.6/shutil.py", line 359, in copytree
raise Error(errors)
shutil.Error: [('foo/bar', 'bar/bar', "[Errno 95] Not supported: 'bar/bar'")]
```


By looking at pyconfig, I get the following:

```
/ # grep -E '(HAVE_FCHMODAT|HAVE_LCHMOD)' /usr/include/python3.6m/pyconfig.h 
#define HAVE_FCHMODAT 1
#define HAVE_LCHMOD 1
```

But it seems lchmod is actually nonfunctional in this case.

I think the fix is to augment `configure` to detect faulty `lchmod` and not set 
`HAVE_LCHMOD`?  I'm not terribly familiar with the autotools pipeline but 
that's where I'm going to take a stab at it!

I'm originally finding this issue via 
https://github.com/pre-commit/pre-commit/issues/655

--
components: Build, Library (Lib), Tests
messages: 305527
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: copystat on symlinks fails for alpine -- faulty lchmod implementation?
versions: 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



[issue31940] copystat on symlinks fails for alpine -- faulty lchmod implementation?

2017-11-03 Thread Anthony Sottile

Anthony Sottile  added the comment:

Here's one idea for a patch (inspired by the rest of the function):

```
diff --git a/Lib/shutil.py b/Lib/shutil.py
index 464ee91..2099289 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -213,6 +213,13 @@ def copystat(src, dst, *, follow_symlinks=True):
 # symlink.  give up, suppress the error.
 # (which is what shutil always did in this circumstance.)
 pass
+except OSError as why:
+# lchmod on alpine will raise this with symlinks: #31940
+for err in 'EOPNOTSUPP', 'ENOTSUP':
+if hasattr(errno, err) and why.errno == getattr(errno, err):
+break
+else:
+raise
 if hasattr(st, 'st_flags'):
 try:
 lookup("chflags")(dst, st.st_flags, follow_symlinks=follow)
```

However lchmod seems to be just broken on alpine so the tests continue to fail 
(however my usecase is fixed)

--

___
Python tracker 

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



[issue31889] difflib SequenceMatcher ratio() still have unpredictable behavior

2017-11-03 Thread Tim Peters

Tim Peters  added the comment:

Pass "autojunk=False" to your SequenceMatcher constructor and the ratio you get 
back will continue to increase as `i` increases.

The docs:

"""
Automatic junk heuristic: SequenceMatcher supports a heuristic that 
automatically treats certain sequence items as junk. The heuristic counts how 
many times each individual item appears in the sequence. If an item’s 
duplicates (after the first one) account for more than 1% of the sequence and 
the sequence is at least 200 items long, this item is marked as “popular” and 
is treated as junk for the purpose of sequence matching. This heuristic can be 
turned off by setting the autojunk argument to False when creating the 
SequenceMatcher.
"""

Note in particular the "at least 200 items long" there.  That's why you see a 
change in behavior at i == 200.  Before then, the autojunk heuristic is not 
triggered.

If we had it all to do over again, I'd make autojunk=False the default.  But - 
for backward compatibility - it's too late to change that now.

As to quick_ratio() and real_quick_ratio(), NOTHING about them is defined - or 
intended to be defined - beyond what the docs already say:

"""
quick_ratio()
Return an upper bound on ratio() relatively quickly.

real_quick_ratio()
Return an upper bound on ratio() very quickly.
"""

Nothing in the code you posted violates those promises (e.g., 0.99 is certainly 
an upper bound with respect to 0.0).  If they always returned 1.0, regardless 
of inputs, that would meet the docs' promises too.  Only the result of ratio() 
is defined.

As to why they exist, the docs explain that:

"""
ratio()
Return a measure of the sequences’ similarity as a float in the range [0, 1].

...

This is expensive to compute if get_matching_blocks() or get_opcodes() hasn’t 
already been called, in which case you may want to try quick_ratio() or 
real_quick_ratio() first to get an upper bound.
"""

So if the expense of calling ratio() isn't a concern in your context, there's 
no reason to call quick_ratio() or real_quick_ratio().  They exist so it's 
possible to code a cheap "early out" path in contexts where calling ratio() all 
the time may be prohibitively expensive.

For example, consider an app that has no use at all for a ratio < 0.5.  If 
quick_ratio() (or real_quick_ratio()) return something less than 0.5, then it's 
guaranteed that ratio() would too, since the quicker versions return upper 
bounds on what ratio() would return.

This is valuable where it matters, and completely useless where it doesn't 
matter ;-)

In any case, since `autojunk=False` repairs the behavior you pointed out, I'm 
closing this as Won't-Fix.

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



Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Steve D'Aprano
On Sat, 4 Nov 2017 06:15 am, Michael Torrie wrote:

> In fact if you have no break you may as well drop the
> else entirely, because the block will always execute.

That's incorrect. There are multiple ways to exit a loop that will prevent the
`else` block from executing, `break` is only one.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Thread safety issue (I think) with defaultdict

2017-11-03 Thread Steve D'Aprano
On Sat, 4 Nov 2017 05:12 am, Israel Brewster wrote:

[...]
>> People generally understand how to move data around, and the mistakes are
>> usually pretty obvious when they happen.
> 
> I think the existence of this thread indicates otherwise :-) This mistake
> was far from obvious, and clearly I didn't understand properly how to move
> data around *between processes*. Unless you are just saying I am ignorant or
> something? :-)

Yes, you were ignorant -- you didn't even realise that you were using
processes, you thought you were using threaded code when it was actually
multiprocessing code. No wonder you got it wrong.

Of course you have a good excuse: the multiprocessing is hidden deep inside
not just the library you were using, but the library *it* was using.

(I don't know how obvious the documentation of the libraries make this --
maybe they're to blame, for not being clear enough -- or maybe you were
simply ignorant about the tools you were using.)

You can't judge multiprocessing code on the basis of bugs caused by assuming
that it was threading code, writing in a threading style with shared data. If
you misuse your tools, that's not the tool's fault.

If anything, we can say that the ultimate error was that you decided to write
in a threaded style without actually using threads: the error was your
(dangerous?) choice to write non-deterministic code using shared data.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31935] subprocess.run() timeout not working with grandchildren and stdout=PIPE

2017-11-03 Thread Martin Panter

Martin Panter  added the comment:

This proposal sounds like a race condition. Closing the output pipe as a child 
exits means you risk missing recent output. On the other hand, if you don’t 
care about the output any more, close the pipe first and then wait for the 
child.

Related discussions:

Issue 30154: Similar problem, but the grandchild does not write any output
Issue 26534: kill_group=True option for timeout
Issue 31447: Windows-specific (?)

--
nosy: +martin.panter

___
Python tracker 

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



[issue31941] ImportError: DLL Load Failure: The specified module cannot be found

2017-11-03 Thread xoviat

New submission from xoviat :

Yes, I know that this isn't Python's fault. I know how to resolve the problem. 
But what's frustrating is that this error message is totally unhelpful, because 
it doesn't contain the DLL that Python is looking for.

Yes, I know that the error message is just directly from windows. But there has 
to be some way to make this error message more helpful. There has to be some 
way to tell the user what the name of the DLL is. Because the current state of 
this error message is sad.

--
messages: 305531
nosy: xoviat
priority: normal
severity: normal
status: open
title: ImportError: DLL Load Failure: The specified module cannot be found
type: enhancement

___
Python tracker 

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



[issue31941] ImportError: DLL Load Failure: The specified module cannot be found

2017-11-03 Thread R. David Murray

R. David Murray  added the comment:

Duplicate of #25655.  Any concrete proposals for how to make this better are 
welcome.

--
nosy: +r.david.murray
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Python errors related to failures loading DLL's lack information

___
Python tracker 

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



[issue31933] some Blake2 parameters are encoded backwards on big-endian platforms

2017-11-03 Thread Christian Heimes

Christian Heimes  added the comment:


New changeset a512493371a073e252a2e52b445aa2d66ddca7cb by Christian Heimes 
(Miss Islington (bot)) in branch '3.6':
bpo-31933: fix blake2 multi-byte params on big endian platforms (GH-4250) 
(#4262)
https://github.com/python/cpython/commit/a512493371a073e252a2e52b445aa2d66ddca7cb


--

___
Python tracker 

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



[issue9678] uuid._ifconfig_getnode can't work on NetBSD

2017-11-03 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +4226
status: pending -> open

___
Python tracker 

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



[issue31936] "5. The import system" grammatical error

2017-11-03 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:


New changeset 93952f881500053057c2e08c4b253ac61233d7db by Barry Warsaw in 
branch 'master':
Fix a grammatical problem and reword for clarity. (#4257)
https://github.com/python/cpython/commit/93952f881500053057c2e08c4b253ac61233d7db


--

___
Python tracker 

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



[issue31937] Add the term "dunder" to the glossary

2017-11-03 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

-1 until we have something we can call a "mifflin".

(Kidding of course!)

--
nosy: +barry

___
Python tracker 

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



[issue31937] Add the term "dunder" to the glossary

2017-11-03 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:

> until we have something we can call a "mifflin".

Name of next GitHub bot? :P

--
nosy: +Mariatta

___
Python tracker 

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



[issue31415] Add -X option to show import time

2017-11-03 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

> `PYTHONPROFILEIMPORTTIME=x python` isn’t *too* onerous

It does not work on Windows.

C:\Users\Terry>PYTHONPROFILEIMPORTTIME=x python
'PYTHONPROFILEIMPORTTIME' is not recognized as an internal or external command, 
operable program or batch file.

Does it set the EV for the entire session (which one likely would not want), or 
just the one command (which has no Windows equivalent that I know of)?  Please 
leave the easily remembered and typed option.

--

___
Python tracker 

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



[issue31415] Add -X option to show import time

2017-11-03 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

On Windows you can create a 2-line bat-file that sets the environment variable 
and runs Python.

--

___
Python tracker 

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



[issue31932] setup.py cannot find vcversall.bat on MSWin 8.1 if installed in user AppData

2017-11-03 Thread Hugh Fisher

Change by Hugh Fisher :


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

___
Python tracker 

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



[issue31938] Convert selectmodule.c to Argument Clinic

2017-11-03 Thread Tal Einat

Tal Einat  added the comment:

See PR 4265.

--

___
Python tracker 

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



Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Ian Kelly
On Fri, Nov 3, 2017 at 3:25 PM, Stefan Ram  wrote:
> Jon Ribbens  writes:
>>No, it's an obvious bug. You have a 'for...else' with no 'break'.
>>Like I said, that should probably be a syntax error.
>
>   It should make the syntax of Python much more complicated,
>   when one would try to encode this rule in the /syntax/.
>
>   (Just try to write down the EBNF.)
>
>   It would be more reasonable to call it a constraint.
>   Maybe it could still be a parser error (not a runtime
>   error).

Regardless of whether it's encoded in the EBNF or a constraint on the
resulting parse tree, the eventual outcome would still be called a
syntax error.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31938] Convert selectmodule.c to Argument Clinic

2017-11-03 Thread Tal Einat

Change by Tal Einat :


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

___
Python tracker 

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



Re: python3 byte decode

2017-11-03 Thread Terry Reedy

On 11/3/2017 5:24 AM, Ali Rıza KELEŞ wrote:

Hi,

Yesterday, while working with redis, i encountered a strange case.

I want to ask why is the following `True`

```
"s" is b"s".decode()
```

while the followings are `False`?

```
"so" is b"so".decode()
"som" is b"som".decode()
"some" is b"some".decode()
```

Or vice versa?

I read that `is` compares same objects, not values. So my question is
why "s" and b"s".decode() are same objects, while the others aren't?


For the same reason as

>>> a = 1
>>> b = 1
>>> a is b
True
>>> a = 1000
>>> b = 1000
>>> a is b
False

For CPython, 'small' ints are cached on startup.  Ditto for 'small' 
strings, which I think includes all 128 ascii chars, and maybe latin1 
chars.  Details depends on the implemention and version.  The main use 
of 'is' for immutable builtins is for developers to test the 
implementation in the test suite.


--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list


[issue31889] difflib SequenceMatcher ratio() still have unpredictable behavior

2017-11-03 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
nosy: +tim.peters
versions: +Python 3.7 -Python 3.5

___
Python tracker 

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



[issue31924] Fix test_curses on NetBSD 8

2017-11-03 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 8ce98543ef959bb65da2fb57b0d442b3b6e8a087 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
bpo-31924: Fix test_curses on NetBSD 8. (GH-4228) (#4259)
https://github.com/python/cpython/commit/8ce98543ef959bb65da2fb57b0d442b3b6e8a087


--

___
Python tracker 

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



[issue31924] Fix test_curses on NetBSD 8

2017-11-03 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 6a9a331b34f39a3df1c3a91ffcac12a9608b1e57 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '2.7':
bpo-31924: Fix test_curses on NetBSD 8. (GH-4228) (#4260)
https://github.com/python/cpython/commit/6a9a331b34f39a3df1c3a91ffcac12a9608b1e57


--

___
Python tracker 

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



[issue31904] Python should support VxWorks RTOS

2017-11-03 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The following might be relevant to this issue:
https://www.python.org/dev/peps/pep-0011/#supporting-platforms

--
nosy: +terry.reedy

___
Python tracker 

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



[issue31937] Add the term "dunder" to the glossary

2017-11-03 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:

Anyway, +1 to adding dunder to glossary.

--

___
Python tracker 

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



[issue31938] Convert selectmodule.c to Argument Clinic

2017-11-03 Thread Tal Einat

New submission from Tal Einat :

Continuing the work begun as part of issue #20182, this is regarding the 
Argument Clinic conversion of Modules/selectmodule.c.h.

I have a complete conversion ready and will create a PR momentarily.

--
components: Argument Clinic
messages: 305514
nosy: haypo, larry, serhiy.storchaka, taleinat
priority: normal
severity: normal
status: open
title: Convert selectmodule.c to Argument Clinic
type: enhancement
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



[issue31415] Add -X option to show import time

2017-11-03 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Note that with environment variable you get more information.

$ ./python -X importtime -c pass
import time: self [us] | cumulative | imported package
import time:88 | 88 | _codecs
import time:   789 |876 |   codecs
import time:   602 |602 |   encodings.aliases
import time:   809 |   2287 | encodings
...

$ PYTHONPROFILEIMPORTTIME=1 ./python -c pass
import time: self [us] | cumulative | imported package
import time:  3133 |   3133 | _frozen_importlib_external
import time:   371 |371 | zipimport
import time:   327 |327 | _codecs
import time:  2656 |   2982 |   codecs
import time:  1821 |   1821 |   encodings.aliases
import time:  2604 |   7406 | encodings
...

--

___
Python tracker 

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



[issue31870] add timeout parameter for get_server_certificate in ssl.py

2017-11-03 Thread Christian Heimes

Change by Christian Heimes :


--
assignee:  -> christian.heimes
components: +SSL -Library (Lib)
nosy: +alex, christian.heimes, dstufft, janssen
stage:  -> patch review
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



[issue20182] Derby #13: Convert 50 sites to Argument Clinic across 5 files

2017-11-03 Thread Tal Einat

Tal Einat  added the comment:

See issue #31938 regarding Modules/selectmodule.c.

--

___
Python tracker 

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



[issue31924] Fix test_curses on NetBSD 8

2017-11-03 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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



[issue9678] uuid._ifconfig_getnode can't work on NetBSD

2017-11-03 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
versions: +Python 3.6, Python 3.7 -Python 3.4, Python 3.5

___
Python tracker 

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



[issue31936] "5. The import system" grammatical error

2017-11-03 Thread Barry A. Warsaw

Change by Barry A. Warsaw :


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



[issue31937] Add the term "dunder" to the glossary

2017-11-03 Thread Brett Cannon

New submission from Brett Cannon :

The term "dunder" is used out in the community regularly, but if you have never 
been exposed to it before it can seem a little odd without context.

--
assignee: docs@python
components: Documentation
messages: 305509
nosy: brett.cannon, docs@python
priority: normal
severity: normal
status: open
title: Add the term "dunder" to the glossary

___
Python tracker 

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



[issue4356] Add "key" argument to "bisect" module functions

2017-11-03 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

obviously didn't make it in 3.6 but this still seems desirable.  I just saw 
someone at work propose a trivial port of golang's sort.Search - 
https://golang.org/pkg/sort/#Search - in Python which caused me to hunt for an 
issue on bisect key= support.

--
nosy: +gregory.p.smith
versions: +Python 3.7 -Python 3.6

___
Python tracker 

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



[issue31933] some Blake2 parameters are encoded backwards on big-endian platforms

2017-11-03 Thread Christian Heimes

Change by Christian Heimes :


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



[issue31415] Add -X option to show import time

2017-11-03 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

On Nov 3, 2017, at 11:05, Serhiy Storchaka  wrote:
> 
> But now, after adding the environment variable, do we still need the -X 
> option? From a user side I don't see much difference between specifying an 
> option and an environment variable, but the code for handling the environment 
> variable is much simpler.

It’s a good question.  I guess in the limited amount of time I’ve used the 
feature so far, I find it kind of nice to be able to type `python -X 
importtime` when doing general import profiling.  The use case for the 
environment variable is more compelling IMHO which is why I really wanted to 
add it.  I suppose typing `PYTHONPROFILEIMPORTTIME=x python` isn’t *too* 
onerous, even if it is kind of a weird long mashed together word.

I suppose I’m -0 on removing the -X option, and +0 on adding the negative cache.

--

___
Python tracker 

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



[issue31895] Native hijri calendar support

2017-11-03 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Haneef, thank you for the explanation.  Any such addition would need a PEP.  
But I agree with Marc-Andre that supporting the multitude of calendars is out 
of scope for the stdlib.  So I suspect such a PEP would be rejected, with the 
suggestion already given here, that this belongs on PyPI.  An existing example 
is the time module of the astropy module,
http://docs.astropy.org/en/stable/time/index.html .

I could be wrong, but I have a vague impression that expanding calendar support 
has been requested and rejected before.  We have enough to do properly 
supporting the existing time, datetime, and calendar modules.

--
nosy: +terry.reedy
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



[issue31896] In function define class inherit ctypes.structure, and using ctypes.pointer leak memory

2017-11-03 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The tracker is for patching CPython.  Please consider closing this and asking 
your question on python-list.  When you post code, do so only once, and without 
line numbers, so it can be copied and run as is.  Do include data on the ref 
leaks.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue20182] Derby #13: Convert 50 sites to Argument Clinic across 5 files

2017-11-03 Thread Tal Einat

Change by Tal Einat :


--
pull_requests: +4229

___
Python tracker 

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



Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Chris Angelico
On Sat, Nov 4, 2017 at 1:57 PM, Michael Torrie  wrote:
> On 11/03/2017 07:09 PM, Steve D'Aprano wrote:
>> On Sat, 4 Nov 2017 06:15 am, Michael Torrie wrote:
>>
>>> In fact if you have no break you may as well drop the
>>> else entirely, because the block will always execute.
>>
>> That's incorrect. There are multiple ways to exit a loop that will prevent 
>> the
>> `else` block from executing, `break` is only one.
>
> Such as?

There are many. But other than break, I don't know of any that WOULD
execute the next line of code immediately _after_ the loop.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31415] Add -X option to show import time

2017-11-03 Thread INADA Naoki

INADA Naoki  added the comment:

I'm +1 to remove -X option.
Supporting both form makes code ugly and benefit is too small.
And +1 to negative cache too.   It's simple for environment varianle.

--

___
Python tracker 

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



[issue31940] copystat on symlinks fails for alpine -- faulty lchmod implementation?

2017-11-03 Thread Anthony Sottile

Change by Anthony Sottile :


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

___
Python tracker 

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



Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Michael Torrie
On 11/03/2017 09:06 PM, Chris Angelico wrote:
> On Sat, Nov 4, 2017 at 1:57 PM, Michael Torrie  wrote:
>> On 11/03/2017 07:09 PM, Steve D'Aprano wrote:
>>> On Sat, 4 Nov 2017 06:15 am, Michael Torrie wrote:
>>>
 In fact if you have no break you may as well drop the
 else entirely, because the block will always execute.
>>>
>>> That's incorrect. There are multiple ways to exit a loop that will prevent 
>>> the
>>> `else` block from executing, `break` is only one.
>>
>> Such as?
> 
> There are many. But other than break, I don't know of any that WOULD
> execute the next line of code immediately _after_ the loop.

Can you be more specific? What are some of these "many" ways of aborting
a loop?  Help a guy out here.

I know, for example, that we have exceptions. But those hardly matter in
this discussion because they wouldn't execute the else clause either.
They'd either be caught elsewhere, or end the program.  sys.exit() can
also terminate a for loop, but it terminates the whole program without
running the else statement.




-- 
https://mail.python.org/mailman/listinfo/python-list


Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread Michael Torrie
On 11/03/2017 07:09 PM, Steve D'Aprano wrote:
> On Sat, 4 Nov 2017 06:15 am, Michael Torrie wrote:
> 
>> In fact if you have no break you may as well drop the
>> else entirely, because the block will always execute.
> 
> That's incorrect. There are multiple ways to exit a loop that will prevent the
> `else` block from executing, `break` is only one.

Such as?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31898] Add a `recommended-packages.txt` file

2017-11-03 Thread Nick Coghlan

Nick Coghlan  added the comment:

In https://mail.python.org/pipermail/python-ideas/2017-October/047599.html, 
Guido suggested managing this as an occasionally updated Informational PEP 
(somewhat akin to PEP 394), and I think that will actually work fairly well:

* it clearly gives the information PEP level status (which merely being in the 
developer guide wouldn't)
* it means the guidance can be mostly version independent (which would be a 
source of irritation if the list was in the reference documentation)
* it means we can use the same process for amendments as we do for other 
informational PEPs (a combination of python-dev discussions, bugs.python.org 
issues, and specific PR reviews)

My current thoughts on structuring that:

Title: Recommended Independently Updated Python Packages

Tone/Audience: I'll aim the PEP primarily at answering the "Why isn't  in 
the standard library?" question, as that helps us keep the list focused on 
python-dev specific concerns and avoid turning it into a general categorised 
list of Python library recommendations like 
https://github.com/vinta/awesome-python

The key criterion for something being mentioned will be when the standard 
library *already* contains comparable functionality, but there's a language 
version independent third party alternative that even core developers will 
often use instead. That list is currently:

urllib.requests -> requests (pace of change in web standards)
re -> regex (technical challenges with backend migration)
datetime.timezone -> pytz.timezone (updates driven by IANA timezone database)
ctypes -> cffi (build tools should be version independent)
distutils -> setuptools (build tools should be version independent)

I'll likely also include a list of libraries where version independence is a 
key feature, so they've never even been proposed for stdlib inclusion, despite 
their broad popularity:

- the six compatibility module
- various backport libraries (e.g. importlib2, contextlib2, unittest2)
- third party libraries like lxml

I'm not sure if or how I'll cover the scientific Python stack (especially 
NumPy.ndarray being the reference implementation for multi-dimensional arrays), 
but Nathaniel Smith has some interesting thoughts on that in 
https://mail.python.org/pipermail/python-ideas/2017-November/047636.html

--

___
Python tracker 

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



Re: Share unpickleable object across processes

2017-11-03 Thread dieter
Israel Brewster  writes:

> I have a Flask/UWSGI web app that serves up web socket connections. When a 
> web socket connection is created, I want to store a reference to said web 
> socket so I can do things like write messages to every connected 
> socket/disconnect various sockets/etc. UWSGI, however, launches multiple 
> child processes which handle incoming connections, so the data structure that 
> stores the socket connections needs to be shared across all said processes. 
> How can I do this?

At low (= Posix) level, socket objects are represented as
ints, representing an "open communication object".

Usually, a child process shares the parent's "open communication object"s
*AT THE TINE OF THE CHILD CREATION*. However, often, this sharing
is broken very quickly: the parent may have set up those objects
to close automatically in the child; the parent may close its
"open communication object" after the spawning of the child.

If two processes have not inherited the same "open communication object"
from a common ancestor, there is no way that they can share
the communication object.


I am quite convinced that UWSGI will
be set up to close "open communication object"s passed on to
child processes. Thus, I see little chance that your current approach
can succeed.

-- 
https://mail.python.org/mailman/listinfo/python-list


<    1   2