[issue38705] venv creation on macOS Catalina is failing

2019-11-05 Thread Ned Deily


Change by Ned Deily :


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



[issue38715] Regression in compileall ddir parameter when recursing

2019-11-05 Thread hetman


New submission from hetman :

There appears to have been a regression introduced in the compileall library 
back with Python 3.5 as a result of commit f1a8df0ac98 .

The issues appears when compiling a hierarchy of directories with the 'ddir' 
parameter specified (either in the compile_dir() function or via the '-d' 
command line parameter).

Examining the code before the f1a8df0ac98 commit suggests the original intent 
for the 'ddir' parameter, when recursing into subdirectories, was to alter the 
root of the path displayed in exception traces. That means that the 
hierarchical directory structure of the reported source path in each compiled 
file was maintained, and only the root directory being compiled was replaced 
with ddir.

More recently two new parameters, 'stripdir' and 'prependdir', have been added 
with commit 8e7bb991de7 which seem to largely reimplement the missing behaviour 
in a different way.

The current behaviour does not seem very useful or expected. I think it would 
be helpful to restore the original behaviour and would be happy to contribute a 
PR to do so. Additionally it may be worth consulting the submitter of bpo-38112 
whether the alternative arguments are still necessary once the regression is 
fixed, though this is optional and not needed to fix the core issue.



Here's a simple script to demonstrate the above:

mkdir -p library/a/a

cat <<'EOF' > library/__init__.py
def go():
  raise AssertionError('dummy')
EOF
cp library/__init__.py library/a/__init__.py
cp library/__init__.py library/a/a/__init__.py

python3 -m compileall -b -d /usr/lib library
rm library/**/*.py

python3 -c 'from library import go; go()'
python3 -c 'from library.a import go; go()'
python3 -c 'from library.a.a import go; go()'



And the resulting output which shows that each module is claiming to be raised 
from the same location:

Listing 'library'...
Compiling 'library/__init__.py'...
Listing 'library/a'...
Compiling 'library/a/__init__.py'...
Listing 'library/a/a'...
Compiling 'library/a/a/__init__.py'...

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/__init__.py", line 2, in go
AssertionError: dummy

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/__init__.py", line 2, in go
AssertionError: dummy

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/__init__.py", line 2, in go
AssertionError: dummy

--
components: Library (Lib)
messages: 356102
nosy: hetman
priority: normal
severity: normal
status: open
title: Regression in compileall ddir parameter when recursing
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue38712] add signal.pidfd_send_signal

2019-11-05 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

Yes, I thought about that a bit. I choose signal because:

1. signal already has some specialized functions that send signals pthread_kill 
and raise_signal.
2. If we every do want to implement the third parameter of pidfd_send_signal, 
the signal module already defines a siginfo structseq.
3. (least convincing) os/posix has way too much stuff. I generally think that 
we should strive to find a good home for new OS-level functionality that isn't 
the os module.

--

___
Python tracker 

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



[issue38684] hashlib: build fails when blake2 is disabled in OpenSSL

2019-11-05 Thread Christian Heimes


Christian Heimes  added the comment:

Thanks!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> compile error

___
Python tracker 

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



[issue38684] hashlib: build fails when blake2 is disabled in OpenSSL

2019-11-05 Thread miss-islington


miss-islington  added the comment:


New changeset 7c20888e71304ecbf4bd3d595f364b7c691d30a0 by Miss Islington (bot) 
in branch '3.8':
bpo-38684: haslib: fix build when Blake2 not enabled in OpenSSL (GH-17043)
https://github.com/python/cpython/commit/7c20888e71304ecbf4bd3d595f364b7c691d30a0


--
nosy: +miss-islington

___
Python tracker 

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



[issue38713] expose P_PIDFD

2019-11-05 Thread miss-islington


miss-islington  added the comment:


New changeset 5c0c325453a175350e3c18ebb10cc10c37f9595c by Miss Islington (bot) 
(Benjamin Peterson) in branch 'master':
closes bpo-38713: Expose P_PIDFD in os if it's defined. (GH-17071)
https://github.com/python/cpython/commit/5c0c325453a175350e3c18ebb10cc10c37f9595c


--
nosy: +miss-islington
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



[issue38709] distutils - setuptools - alias command removes comments from setup.cfg

2019-11-05 Thread Arno-Can Uestuensoez


Arno-Can Uestuensoez  added the comment:

Current related issues are:

issue 38714
issue 38711
issue 38709

--

___
Python tracker 

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



[issue38711] setup parameter 'distclass' ignored for configuration files

2019-11-05 Thread Arno-Can Uestuensoez


Arno-Can Uestuensoez  added the comment:

Current related issues are:

issue 38714
issue 38711
issue 38709

--

___
Python tracker 

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



[issue38714] setup command alias erroneous for names with hyphens

2019-11-05 Thread Arno-Can Uestuensoez


Arno-Can Uestuensoez  added the comment:

Current related issues are:

issue 38714
issue 38711
issue 38709

--

___
Python tracker 

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



[issue38714] setup command alias erroneous for names with hyphens

2019-11-05 Thread Arno-Can Uestuensoez


Change by Arno-Can Uestuensoez :


--
type:  -> behavior

___
Python tracker 

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



[issue38714] setup command alias erroneous for names with hyphens

2019-11-05 Thread Arno-Can Uestuensoez


New submission from Arno-Can Uestuensoez :

Even though this involves 'setuptools', I write this issue here because of the 
tight coupling of 'distutils' and 'setuptools' e.g. by the passed 'self' 
parameter.

The aliases as represented by the command 'setup.py alias' are internally 
treated by 'setuptools' as options.

See code:

   setuptools.dist._parse_config_files()
   in Python-3.8.0:  line 604 - line 608

The consequence is the processing of the standard replacement of hyphens by 
underscores for alias names.

The resulting behaviour is here three folded.


1. The technical behaviour of the alias replacement for valid
   aliases id flawless.

2. The technical behaviour of the display representation for alias
   names containing a hyphen is erroneous.

   For example:

  python setup.py alias my-alias alias

   Results flawless in:

  [aliases]
  my-alias = alias

   The display:

  python setup.py alias

   is erroneous:

  (3.8.0)$ python setup.py alias
  running alias
  Command Aliases
  ---
  setup.py alias my_alias alias

   because the modified internal values are displayed - with replaced
   hyphens in alias names.


3. The call of the alias as command replacement is erroneous in general:

  3.0. the original call is flawless:

 (3.8.0)$ python setup.py alias

running alias
Command Aliases
---
setup.py alias my_alias alias


  3.1. the call by defined literal alias is erroneous:

(3.8.0)$ python setup.py my-alias

invalid command name 'my-alias'

  3.2. the call by modified alias is also erroneous,
 as though the alias is not detected, resulting here in the
 display of an empty list:

(3.8.0)$ python setup.py my_alias

running alias
Command Aliases
---


Another example to mention here is the acceptance of alias names including 
spaces, which prbably should be suppressed, because as far as I can see command 
name could not contain spaces at all.

E.g. the alias 'ls -l' is handeled erroneous in accordance to the previous 
remarks, but is basically not valid at all.

   (3.8.0)$ python setup.py 'ls -l' alias

Results in the flawless configuration entry:

   [aliases]
   ls -l = alias

The erroneous display:

(3.8.0)$ python setup.py alias

running alias
Command Aliases
---
setup.py alias ls _l alias

The behaviour should be fixed to be consistent to allow valid names and reject 
others. The accepted names should be fully functional, and displayed and made 
available for custom representation literally as provided by the user. A simple 
reverse-replacement is here not reliable.

The alternative of the caching of the original input is currently not possible 
for a simple public command API due to the lack of fully customization of the 
'distclass' see issue Issue38711. Thus this seems currently to require a 
complete second scan including eventually selected user files as eventually 
selected by the provided call parameters.

--
components: Distutils
messages: 356094
nosy: acue, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: setup command alias erroneous for names with hyphens
versions: Python 2.7, 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



[issue38712] add signal.pidfd_send_signal

2019-11-05 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

I guess a bikeshed question is whether it should be `os.pidfd_send_signal` 
(like `os.kill`) or `signal.pidfd_send_signal` (like `signal.pthread_kill`).

I don't actually care either way myself :-)

--

___
Python tracker 

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



[issue38713] expose P_PIDFD

2019-11-05 Thread Benjamin Peterson


Change by Benjamin Peterson :


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

___
Python tracker 

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



[issue38713] expose P_PIDFD

2019-11-05 Thread Benjamin Peterson


New submission from Benjamin Peterson :

On Linux 5.4, P_PIDFD allows using waitid with a pidfd.

--
components: Library (Lib)
messages: 356092
nosy: benjamin.peterson, njs
priority: normal
severity: normal
status: open
title: expose P_PIDFD
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



[issue38712] add signal.pidfd_send_signal

2019-11-05 Thread Benjamin Peterson


Change by Benjamin Peterson :


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

___
Python tracker 

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



[issue38712] add signal.pidfd_send_signal

2019-11-05 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
nosy: +njs

___
Python tracker 

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



[issue38712] add signal.pidfd_send_signal

2019-11-05 Thread Benjamin Peterson


New submission from Benjamin Peterson :

Add signal.pidfd_send_signal, which will wrap the Linux 5.1 syscall of the same 
name.

--
components: Library (Lib)
messages: 356091
nosy: benjamin.peterson
priority: normal
severity: normal
status: open
title: add signal.pidfd_send_signal
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



[issue38711] setup parameter 'distclass' ignored for configuration files

2019-11-05 Thread Arno-Can Uestuensoez


New submission from Arno-Can Uestuensoez :

Even though this involves 'setuptools', I write this issue here because of the 
tight coupling of 'distutils' and 'setuptools' e.g. by the passed 'self' 
parameter.

The central API 'setup()' - 'setuptools.init.setup()' - provides the parameter 
'distclass='. This allows to define a custom 'Distribution' 
class to be used as a replacement of the 'Distribution' class.

First of all for an ordinary user it is not clear whether 
'distutils.dist.Distribution', and/or 'setuptools.dist.Distribution' is 
replaced. Even more confusing, the 'self' parameter is cross-passed between the 
classes by using a derived instance provided by:

   _Distribution = get_unpatched(distutils.core.Distribution)

The second is the integration of the initialization bootstrap, which completely 
ignores the user defined custom class. The main API 'setup()' defined in 
'setuptools.init.setup()' calls first the local private function 
'_install_setup_requires' - 'setuptools.init._install_setup_requires()', which 
calls the instanciates the hardcoded 'distutils.core.Distribution()', and 
therein calls the methods 'dist.parse_config_files()', and 
'dist.fetch_build_eggs()', which - as far as I can see - finally prohibits the 
use of a custom version of these, or easily add another one.

The consequence is that the configuration file parameters could basically not 
be fully customized by the custom class.

The association with the parameter 'distclass' for me - and I guess for others 
too - is that the 'complete' 'Distribution' class could be customized by this 
API. But this is currently not possible. So, even though I see the problems 
that can arise from the use of the modified 'self' parameter - I would propose 
the application of the 'distclass' for the initial bootstrap by the read of the 
configuration file too. In case this prooves too risky - due to 'distutils' 
coupling with 'setuptools', at least a parameter for the initial read of the 
configuration files should be offered.


The best of course would be the fusion of both parts, probably in a future 
release.

I have tested 3.8.0, but as far as I can see this is the case for all releases.

PS: I am writing now another issue for the 'alias' command and going add the 
number as an possible example for the required custom class.

--
components: Distutils
messages: 356090
nosy: acue, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: setup parameter 'distclass' ignored for configuration files
type: behavior
versions: Python 2.7, 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



[issue38710] unsynchronized write pointer in io.TextIOWrapper in 'r+' mode

2019-11-05 Thread Manuel Ignacio Pérez Alcolea

New submission from Manuel Ignacio Pérez Alcolea :

There seems to be a bug in the `io.TextIOWrapper` class while working in 'r+' 
mode, although I can't say the source of the problem is right there.

The write pointer doesn't match `file.tell()` after performing a read operation.

For example, this file, consisting of 3 lines:

  line one
  line two
  line three

Doesn't result in the expected modification running the following program:

with open('file', 'r+', buffering=1) as f:
print(f.tell())  # => 0
print(f.readline().strip())  # we read 1 line
print(f.tell())  # => 9  
print('Hello', file=f)   # we write "Hello\n"
print(f.tell())  # => 34

Instad of

  line one
  Hello
  wo
  line three

It results in

  line one
  line two
  line threeHello

But it works just fine if `f.seek(f.tell())` is added the program, right before 
the write operation.

There are several possible explanations on StackOverflow, involving the 
buffering for IO in text files:

https://stackoverflow.com/a/58722058/11601118

--
components: IO
messages: 356089
nosy: Manuel Ignacio Pérez Alcolea
priority: normal
severity: normal
status: open
title: unsynchronized write pointer in io.TextIOWrapper in 'r+' mode
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



[issue38709] distutils - setuptools - alias command removes comments from setup.cfg

2019-11-05 Thread Arno-Can Uestuensoez


New submission from Arno-Can Uestuensoez :

The command 'alias' rewrites the configuration file completely when a new alias 
is added. The default file is 'setup.cfg'. All comments of the original file 
are stripped off before, though the new 'setup.cfg' does not contain any 
comments.

The comments should be kept literally, just the section '[aliases]' should be 
modified.

The comments in the section '[aliases]' should be basically kept, even though a 
manual modification by the user could cause problems e.g. in case of deleting 
an alias by the 'setup.py alias' command.

Anyhow, at least the only section modified should - must - be the '[aliases]' 
section.

Even though this involves 'setuptools', I write this issue here because of the 
tight coupling of 'distutils' and 'setuptools' e.g. by the passed 'self' 
parameter.

I have tested 3.8.0, but as far as I can see this is the case for all releases.

--
components: Distutils
messages: 356088
nosy: acue, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: distutils - setuptools - alias command removes comments from setup.cfg
type: behavior
versions: Python 2.7, 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



[issue38692] add a pidfd child process watcher

2019-11-05 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
pull_requests: +16578
pull_request: https://github.com/python/cpython/pull/17069

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-05 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 6c4c45efaeb40f4f837570f57d90a0b3429c6ae9 by Benjamin Peterson in 
branch 'master':
bpo-38692: Add os.pidfd_open. (GH-17063)
https://github.com/python/cpython/commit/6c4c45efaeb40f4f837570f57d90a0b3429c6ae9


--

___
Python tracker 

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



[issue38705] venv creation on macOS Catalina is failing

2019-11-05 Thread Den Delimarsky


Den Delimarsky  added the comment:

@ned.deily actually you bring up a very good point, I did not notice that it 
was using the default Catalina Python 3 install. I've chatted with 
@brett.cannon about this earlier and it seemed like the issue was in that the 
Python version I was using is no longer supported, with the fix likely being in 
one of the later branches. I've updated my installation from python.org and 
everything works as expected now. Let me know if you want me to close this 
issue, and thank you for your insights!

--

___
Python tracker 

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



[issue38630] subprocess.Popen.send_signal() should poll the process

2019-11-05 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

Hmm, you know, on further thought, it is actually possible to close this race 
for real, without pidfd.

What you do is split 'wait' into two parts: first it waits for me process to 
become reapable without actually reaping it. On Linux you can do this with 
waitid+WNOWAIT. On kqueue platforms you can do it with kqueue.

Then, you take a lock, and use it to atomically call waitpid/waitid to reap the 
process + update self.returncode to record that you've done so.

In send_signal, we use the same lock to atomically check whether the process 
has been reaped, and then send the signal if it hasn't.

That doesn't fix your test, but it does fix the race condition: as long as 
users only interact with the process through the Popen API, it guarantees that 
send_signal will never rather the wrong process.

--

___
Python tracker 

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



[issue38630] subprocess.Popen.send_signal() should poll the process

2019-11-05 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

You can't solve a time-of-check-to-time-of-use race by adding another check. I 
guess your patch might narrow the race window slightly, but it was a tiny 
window before and it's a tiny window after, so I don't really get it.

The test doesn't demonstrate a race condition. What it demonstrates is 
increased robustness against user code that corrupts Popen's internal state by 
reaping one of its processes behind its back.

That kind of robustness might be a good motivation on its own! (I actually just 
did a bunch of work to make trio more robust against user code closing fds 
behind its back, which is a similar kind of thing.) But it's a very different 
motivation than what you say in this bug.

--

___
Python tracker 

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



[issue38706] What should the error message in the exception raised by assertTrue and assertFalse be?

2019-11-05 Thread Ammar Askar


Ammar Askar  added the comment:

I like Steven's "truthy value" or "true value" proposal. Another alternative:

"x does not evaluate to true"
"x does not evaluate to false"

--
nosy: +ammar2

___
Python tracker 

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



[issue38706] What should the error message in the exception raised by assertTrue and assertFalse be?

2019-11-05 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Since error messages aren't part of the API and backwards-compatibility doesn't 
apply to them, this could still go into 3.8.

--
stage: resolved -> 
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



[issue38706] What should the error message in the exception raised by assertTrue and assertFalse be?

2019-11-05 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

I'm reopening this as an enhancement, because I think Mikeli is onto something 
here. I'd like to propose making the messages:

"False is not a truthy value."
"True is not a falsey value."

to make it explicit that we are testing not for the singletons True and False 
by identity, but for any truthy or falsey value.

If you don't like the terms "truthy" and "falsey", lower-case true and false 
would also be acceptable.

--
nosy: +steven.daprano
resolution: not a bug -> 
status: closed -> open
type:  -> enhancement
versions:  -Python 2.7, 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



[issue38703] should we expect round(0.95, 1) to be 1.0, instead of 0.9?

2019-11-05 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Possibly even easier than using Decimal:

py> '%.17f' % 0.95
'0.94996'

BTW, this is a FAQ:

https://docs.python.org/3/faq/design.html#why-are-floating-point-calculations-so-inaccurate

--
nosy: +steven.daprano

___
Python tracker 

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



Re: permission denied using python 3.8

2019-11-05 Thread Eryk Sun
On 11/5/19, robin deatherage  wrote:
>
> MS Windows uses a UAC User Control. So it is best to not add a package
> to an Admin user on Windows.

The OP would have to install Python in a location that that's
inaccessible to standard users and add this directory to the system
PATH. It's dysfunctional to add directories to the system PATH that do
not grant read and execute access to standard users, so that would be
a simple installation error. (Unlike Unix, Windows does not keep
searching PATH until it finds a file that it's allowed to execute. It
tries to execute the first match it finds, even if it's not permitted
to do so.) Also, this does not explain why the 3.7 installation works,
assuming the OP follows a similar installation procedure in that case.

For both 3.7 and 3.8, we need to know how Python is executed,
including the fully-qualified path of python.exe (e.g. from running
`where.exe python`). Also, from an administrator command prompt, we
need the discretionary access control list (DACL) of the Python
installation directory and executable (e.g. `icacls.exe ""` and `icacls.exe "\python.exe"`). Also, from a
standard command prompt, we need the current user's list of groups
(e.g. `whoami.exe /groups /fo list`).

> Also there is no limit to how many different versions of Python you use on
> Windows---As long as you have a different UAC Control user logged in Windows
> for each one you add. I have 2.75, 3.5, 3.6, 3.7.0 and now 3.8 on my Windows
> now and all work fine. My user UAC logins may number five but that is is how
> it is suppose to be done anyways in Windows.

Each minor release of Python can be installed to the same user profile
and/or the system profile, and you can even install both the 32-bit
and 64-bit builds of a minor release. An installation can also be
updated in place to a newer micro release (e.g. 3.7.4 -> 3.7.5) since
minor releases guarantee ABI compatibility for extension modules.
There's no conflict with other installed releases as long as we use
the py.exe launcher to run a particular version (e.g. `py -3.7` and
`py -3.7-32`) and associate .py scripts with the launcher and use
shebangs (e.g. "#!python3.7" and "#!python3.7-32"). If you need
multiple micro releases (e.g. 3.7, 3.7.1, 3.7.2, ...), on the other
hand, it's probably for continuous-integration testing, for which you
can use the provided nuget packages instead of a standard
installation.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: permission denied using python 3.8

2019-11-05 Thread Eryk Sun
On 11/5/19, robin deatherage  wrote:
>
> MS Windows uses a UAC User Control. So it is best to not add a package
> to an Admin user on Windows.

The OP would have to install Python in a location that that's
inaccessible to standard users and add this directory to the system
PATH. It's dysfunctional to add directories to the system PATH that do
not grant read and execute access to standard users, so that would be
a simple installation error. (Unlike Unix, Windows does not keep
searching PATH until it finds a file that it's allowed to execute. It
tries to execute the first match it finds, even if it's not permitted
to do so.) Also, this does not explain why the 3.7 installation works,
assuming the OP follows a similar installation procedure in that case.

For both 3.7 and 3.8, we need to know how Python is executed,
including the fully-qualified path of python.exe (e.g. from running
`where.exe python`). Also, from an administrator command prompt, we
need the discretionary access control list (DACL) of the Python
installation directory and executable (e.g. `icacls.exe ""` and `icacls.exe "\python.exe"`). Also, from a
standard command prompt, we need the current user's list of groups
(e.g. `whoami.exe /groups /fo list`).

> Also there is no limit to how many different versions of Python you use on
> Windows---As long as you have a different UAC Control user logged in Windows
> for each one you add. I have 2.75, 3.5, 3.6, 3.7.0 and now 3.8 on my Windows
> now and all work fine. My user UAC logins may number five but that is is how
> it is suppose to be done anyways in Windows.

Each minor release of Python can be installed to the same user profile
and/or the system profile, and you can even install both the 32-bit
and 64-bit builds of a minor release. An installation can also be
updated in place to a newer micro release (e.g. 3.7.4 -> 3.7.5) since
minor releases guarantee ABI compatibility for extension modules.
There's no conflict with other installed releases as long as we use
the py.exe launcher to run a particular version (e.g. `py -3.7` and
`py -3.7-32`) and associate .py scripts with the launcher and use
shebangs (e.g. "#!python3.7" and "#!python3.7-32"). If you need
multiple micro releases (e.g. 3.7, 3.7.1, 3.7.2, ...), on the other
hand, it's probably for continuous-integration testing, for which you
can use the provided nuget packages instead of a standard
installation.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38692] add a pidfd child process watcher

2019-11-05 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

pidfd_open was added after pidfd pollling, so it should suffice to make sure 
pidfd_open doesn't ENOSYS.

--

___
Python tracker 

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



[issue38696] HTTP modules documentation error

2019-11-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16577
pull_request: https://github.com/python/cpython/pull/17068

___
Python tracker 

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



[issue38696] HTTP modules documentation error

2019-11-05 Thread Zachary Ware


Zachary Ware  added the comment:


New changeset 56698d57691af2272f695f8c17c835ed99545cde by Zachary Ware (Ammar 
Askar) in branch 'master':
bpo-38696: Fix usage example of HTTPStatus (GH-17066)
https://github.com/python/cpython/commit/56698d57691af2272f695f8c17c835ed99545cde


--
nosy: +zach.ware

___
Python tracker 

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



[issue38696] HTTP modules documentation error

2019-11-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16576
pull_request: https://github.com/python/cpython/pull/17067

___
Python tracker 

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



[issue38630] subprocess.Popen.send_signal() should poll the process

2019-11-05 Thread STINNER Victor


STINNER Victor  added the comment:

> But then deeper in the thread it sounded like you concluded that this didn't 
> actually help anything, which is what I would expect :-).

The PR contains a test which demonstrate one race condition. It fails  without 
the fix.

--

___
Python tracker 

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



[issue38630] subprocess.Popen.send_signal() should poll the process

2019-11-05 Thread STINNER Victor


STINNER Victor  added the comment:

> (Except maybe eventually switch to pidfd or similar, but Victor says he wants 
> to use a different issue for that.)

pidfd is not available on all platforms (ex: Windows).

--

___
Python tracker 

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



[issue38696] HTTP modules documentation error

2019-11-05 Thread Ammar Askar


Change by Ammar Askar :


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

___
Python tracker 

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



[issue38630] subprocess.Popen.send_signal() should poll the process

2019-11-05 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

But then deeper in the thread it sounded like you concluded that this didn't 
actually help anything, which is what I would expect :-).

--

___
Python tracker 

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



[issue38630] subprocess.Popen.send_signal() should poll the process

2019-11-05 Thread STINNER Victor


STINNER Victor  added the comment:

> It sounds like there's actually nothing to do here? (Except maybe eventually 
> switch to pidfd or similar, but Victor says he wants to use a different issue 
> for that.) Can this be closed?

I opened this issue to propose PR 16984. Did you notice the PR?

In short, I propose to call poll() before calling os.kill() in send_signal().

--

___
Python tracker 

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



[issue38630] subprocess.Popen.send_signal() should poll the process

2019-11-05 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

It sounds like there's actually nothing to do here? (Except maybe eventually 
switch to pidfd or similar, but Victor says he wants to use a different issue 
for that.) Can this be closed?

--
nosy: +njs

___
Python tracker 

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



[issue38708] parse_message_id in email module is very buggy / crashy

2019-11-05 Thread Dimitri John Ledkov


New submission from Dimitri John Ledkov :

email module has recently got parse_message_id which is more strict now, then 
before.

However, it's not programmed as defensively as expected. Given bogus 
message-id, it crashes with unbound local variable, or like accessing a 
non-existing index.

So hyperkitty had a Message-ID "X"*260 in the testsuite that used to pass with 
3.7, but fails with 3.8.

==
ERROR: test_long_message_id (hyperkitty.tests.lib.test_incoming.TestAddToList)
--
Traceback (most recent call last):
  File "./hyperkitty/tests/lib/test_incoming.py", line 295, in 
test_long_message_id
msg["Message-ID"] = "X" * 260
  File "/usr/lib/python3.8/email/message.py", line 409, in __setitem__
self._headers.append(self.policy.header_store_parse(name, val))
  File "/usr/lib/python3.8/email/policy.py", line 148, in header_store_parse
return (name, self.header_factory(name, value))
  File "/usr/lib/python3.8/email/headerregistry.py", line 602, in __call__
return self[name](name, value)
  File "/usr/lib/python3.8/email/headerregistry.py", line 197, in __new__
cls.parse(value, kwds)
  File "/usr/lib/python3.8/email/headerregistry.py", line 530, in parse
kwds['parse_tree'] = parse_tree = cls.value_parser(value)
  File "/usr/lib/python3.8/email/_header_value_parser.py", line 2116, in 
parse_message_id
message_id.append(token)
UnboundLocalError: local variable 'token' referenced before assignment

Similarly another user, surkova reports that value[0] in get_msg_id function is 
buggy too (doesn't check that value has a member)

First reported 
https://github.com/python/cpython/pull/13397#discussion_r341968031

Ideally, I'd like the function to raise a documented Exception for invalid 
Message-id, but not fail with what look like regular programming bugs in the 
email module. Expectation is that email module is either more permissive or is 
coded more defence-in-depth with more checking in place.

--
messages: 356072
nosy: xnox
priority: normal
severity: normal
status: open
title: parse_message_id in email module is very buggy / crashy
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



[issue38707] Multiprocessing: bug with Native ID for threading.mainthread()

2019-11-05 Thread Jake Tesler


Change by Jake Tesler :


--
nosy: +pitrou

___
Python tracker 

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



[issue38707] Multiprocessing: bug with Native ID for threading.mainthread()

2019-11-05 Thread Jake Tesler


New submission from Jake Tesler :

I have encountered a minor bug with the new `threading.get_native_id()` 
featureset in Python 3.8. The bug occurs when creating a new 
multiprocessing.Process object on Unix (or on any platform where the 
multiprocessing start_method is 'fork' or 'forkserver').

When creating a new process via fork, the Native ID in the new MainThread is 
incorrect. The new forked process' threading.MainThread object inherits the 
Native ID from the parent process' MainThread instead of capturing/updating its 
own (new) Native ID.

See the following snippet:

>>> import threading, multiprocessing
>>> multiprocessing.set_start_method('fork') # or 'forkserver'
>>> def proc(): print(threading.get_native_id(), 
>>> threading.main_thread().native_id) # get_native_id(), mainthread.native_id
>>> proc()
22605 22605 # get_native_id(), mainthread.native_id
>>> p = multiprocessing.Process(target=proc)
>>> p.start()
22648 22605 # get_native_id(), mainthread.native_id
>>>
>>> def update(): threading.main_thread()._set_native_id()
>>> def print_and_update(): proc(); update(); proc()
>>> print_and_update()
22605 22605 # get_native_id(), mainthread.native_id
22605 22605 
>>> p2=multiprocessing.Process(target=print_and_update); p2.start()
22724 22605 # get_native_id(), mainthread.native_id
22724 22724
>>> print_and_update()
22605 22605 # get_native_id(), mainthread.native_id
22605 22605

As you can see, the new Process object's MainThread.native_id attribute matches 
that of the MainThread of its parent process. 

Unfortunately, I'm not too familiar with the underlying mechanisms that 
Multiprocessing uses to create forked processes. 
I believe this behavior occurs because (AFAIK) a forked multiprocessing.Process 
copies the MainThread object from its parent process, rather than 
reinitializing a new one. Looking further into the multiprocessing code, it 
appears the right spot to fix this would be in the 
multiprocessing.Process.bootstrap() function. 

I've created a branch containing a working fix - I'm also open to suggestions 
of how a fix might otherwise be implemented. 
If it looks correct I'll create a PR against the CPython 3.8 branch. 

See the branch here: https://github.com/jaketesler/cpython/tree/fix-mp-native-id

Thanks all!
-Jake

--
components: Library (Lib)
messages: 356070
nosy: jaketesler, vstinner
priority: normal
severity: normal
status: open
title: Multiprocessing: bug with Native ID for threading.mainthread()
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



[issue38692] add a pidfd child process watcher

2019-11-05 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

hasattr is useful for supporting old versions of the os module, but asyncio 
doesn't have to care about that. You should probably try calling pidfd_open and 
see whether you get -ESYSCALL, and also maybe try passing it to poll(), since I 
think there might have been a release where the syscall existed but it wasn't 
pollable. Not sure what the error for that looks like.

--

___
Python tracker 

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



[issue36084] Threading: add builtin TID attribute to Thread objects

2019-11-05 Thread Jake Tesler


Change by Jake Tesler :


--
status: open -> closed

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-05 Thread Kyle Stanley


Kyle Stanley  added the comment:

> My the main question is: how to detect if the new watcher can be used or 
> asyncio should fallback to threaded based solution?

Perhaps in the __init__ we could do something like this:

class PidfdChildWatcher(AbstractChildWatcher):

def __init__(self):
if not hasattr(os, "pidfd_open"):
 raise RuntimeError("os.pidfd_open() is unavailable.")
...

Thoughts?

> My WIP progress patch is attached. It passes all asyncio tests.

I think we could also specifically look for race conditions with `./python -m 
test test_asyncio.test_subprocess -F -j4`, rather than relying on the tests 
passing with a single job. The other child watchers have been particularly 
infamous when it comes race conditions and resource leaks. 

I'd be glad to work on testing and opening a PR to asyncio if needed (while 
giving Benjamin credit for the patch of course).

--
nosy: +aeros

___
Python tracker 

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



Re: What PEPs are worth reading after you've read a textbook/Beazley but want to understand details/innerworkings

2019-11-05 Thread Gregory Ewing

Gilmeh Serda wrote:


Can't wait until we get to PEP 84657675, or PEP 33


PEP TREE(3) promises to be even more exciting!

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


[issue38692] add a pidfd child process watcher

2019-11-05 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-38630 "subprocess.Popen.send_signal() should poll the process".

--

___
Python tracker 

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



Re: OOP - how to abort an __init__ when the initialisation code fails ?

2019-11-05 Thread Gregory Ewing

Peter J. Holzer wrote:

On 2019-11-04 18:18:39 -0300, Luciano Ramalho wrote:


In addition, as Rob said, it is usually a bad idea to wrap several
lines of code in a single try/except block



I disagree with this. While it is sometimes useful to wrap a single
line, in my experience it rarely is. The scope of the try ... except
should be a unit from a semantic point of view. For example, if you
open a file and write some data to it, you could write:

try:
f = open("a.file", "w")
except OSError as e:
... handle exception
try:
f.write("some")
except OSError as e:
... handle exception
try:
f.write("data")
except OSError as e:
... handle exception
try:
close(f)
except OSError as e:
... handle exception

But not only is this hard to read and ugly as heck, what would be the
point? 


Much better to write:

try:
with open("a.file", "w") as f:
f.write("some")
f.write("data")
except OSError as e:
... handle exception

Or maybe don't catch it here at all but just let it bubble up until it
hits a level where dealing with it makes sense from the user's point of
view


Often it makes sense to do both -- catch the exception and
re-raise it with a more informative error message, e.g.

 try:
 with open(filename, "w") as f:
 f.write("some")
 f.write("data")
 except OSError as e:
 raise OSError("Couldn't write fibble data to %s: %s" % (filename, e))

That way you don't get frustrating Microsoft style error
messages which say "The system could not open the specified file"
while giving no clue about *which* file was specified... aarggh!

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


[issue38706] What should the error message in the exception raised by assertTrue and assertFalse be?

2019-11-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

assertTrue() does not assert that the value is True. It asserts that it is 
true. For example, non-zero number or non-empty collections will pass the check.

--
nosy: +serhiy.storchaka
resolution:  -> not a bug
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



[issue38705] venv creation on macOS Catalina is failing

2019-11-05 Thread Ned Deily


Ned Deily  added the comment:

Thanks for the report but without a supplying a reproducible test case it's 
really difficult to say what issue you might be seeing. FWIW, I was not able to 
reproduce a failure but I was just guessing what your project code really does. 
 Also be aware that you appear to be using the Apple-supple Python 3.7.3 that 
is included with Apple's Xcode 11 Command Line Tools for 10.15 Catalina and is 
not part of a standard macOS installation.  I believe that Python3 is there 
only to support other parts of the Command Line Tools and it is not recommended 
that you use it for your own projects.

--

___
Python tracker 

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



[issue38706] What should the error message in the exception raised by assertTrue and assertFalse be?

2019-11-05 Thread Mikeli Karotsieri


Change by Mikeli Karotsieri :


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

___
Python tracker 

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



[issue38706] What should the error message in the exception raised by assertTrue and assertFalse be?

2019-11-05 Thread Mikeli Karotsieri


Change by Mikeli Karotsieri :


--
pull_requests:  -16573

___
Python tracker 

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



[issue38706] What should the error message in the exception raised by assertTrue and assertFalse be?

2019-11-05 Thread Mikeli Karotsieri


New submission from Mikeli Karotsieri :

The error messages included in the exceptions raised when assertTrue and 
assertFalse fail are respectively:  

'False is not true' 
'True is not false '

This issue's goal is to find out if it would be more correct or/and beneficial 
for those messages to be: 

'False is not True' 
'True is not False'

As a side note, the suggested error message is syntactically correct Python. 

The assosciated file is Lib/unittest/case.py .

--
components: Library (Lib)
messages: 356065
nosy: brandtbucher, mkarotsieris
priority: normal
pull_requests: 16573
severity: normal
status: open
title: What should the error message in the exception raised by assertTrue and 
assertFalse be?
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue38705] venv creation on macOS Catalina is failing

2019-11-05 Thread Den Delimarsky


Den Delimarsky  added the comment:

Should also mention that this is working as expected in Python 3.8.0

--

___
Python tracker 

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



[issue38703] should we expect round(0.95, 1) to be 1.0, instead of 0.9?

2019-11-05 Thread Mark Dickinson


Mark Dickinson  added the comment:

What Serhiy said. round is behaving as intended and as designed here.

Note: you can also see the actual value of a float object easily by using 
Decimal:

>>> from decimal import Decimal
>>> Decimal(0.95)
Decimal('0.9499555910790149937383830547332763671875')

... which demonstrates clearly that the value being rounded is closer to 0.9 
than to 1.0.

--
nosy: +mark.dickinson
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



[issue38609] Trashcan mechanism segfault during interpreter finalization in Python 3.7.5

2019-11-05 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

The attached code creates a static (global) C++ object that owns a reference to 
a Python object, and releases that reference in its destructor. That destructor 
runs at program termination, which is after interpreter shutdown (that is after 
Py_FinalizeEx is called).  

After the call to Py_FinalizeEx() the interpreter no longer exists, and it is 
unsafe to call Python API functions (other than the ones listed as safe to call 
before a call to Py_Initialize).  Py_DECREF is not on that safe list.

--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue38705] venv creation on macOS Catalina is failing

2019-11-05 Thread Den Delimarsky


New submission from Den Delimarsky :

I have a project, where I am working inside a virtual environment (on macOS 
Catalina). Inside said project, I am attempting to create a new virtual 
environment with:

venv.create(virtual_environment_directory, with_pip=True)

This, however, errors out:

  File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/runpy.py",
 line 193, in _run_module_as_main
"__main__", mod_spec)
  File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/runpy.py",
 line 85, in _run_code
exec(code, run_globals)
  File "/Users/user1/Documents/repos/adg/src/adg/__main__.py", line 35, in 

CommandProcessor.validate(args, current_os)
  File "/Users/user1/Documents/repos/adg/src/adg/helpers/commandprocessor.py", 
line 21, in validate
LibraryProcessor.process_libraries(command.library, command.platform, 
command.out)
  File "/Users/user1/Documents/repos/adg/src/adg/helpers/coreutil.py", line 79, 
in process_libraries
LibraryInstaller.create_environment()
  File "/Users/user1/Documents/repos/adg/src/adg/helpers/coreutil.py", line 40, 
in create_environment
venv.create(virtual_environment_directory, with_pip=True)
  File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/venv/__init__.py",
 line 363, in create
builder.create(env_dir)
  File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/venv/__init__.py",
 line 68, in create
self._setup_pip(context)
  File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/venv/__init__.py",
 line 261, in _setup_pip
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
  File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/subprocess.py",
 line 395, in check_output
**kwargs).stdout
  File 
"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/subprocess.py",
 line 487, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command 
'['/Users/user1/Documents//repos/adg/src/dtemp/bin/python3', '-Im', 
'ensurepip', '--upgrade', '--default-pip']' died with .

Seems like attempting to run this both from inside and outside the virtual 
environment results in the error.

--
components: macOS
messages: 356061
nosy: dend, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: venv creation on macOS Catalina is failing
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



[issue22253] ConfigParser does not handle files without sections

2019-11-05 Thread Pedro Lacerda


Pedro Lacerda  added the comment:

Hi, there is a working PR at https://github.com/python/cpython/pull/2735. 

I was in doubt about get the default section with `__init__(..., 
allow_unnamed_section=True)` and `config.get('', 'option')` or with 
`config.get(DEFAULT_SECTION, 'option')`. I'd prefer the later.

--

___
Python tracker 

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



Re: OOP - how to abort an __init__ when the initialisation code fails ?

2019-11-05 Thread Rob Gaddi

On 11/5/19 11:52 AM, Peter J. Holzer wrote:

On 2019-11-04 18:18:39 -0300, Luciano Ramalho wrote:

In addition, as Rob said, it is usually a bad idea to wrap several
lines of code in a single try/except block


I disagree with this. While it is sometimes useful to wrap a single
line, in my experience it rarely is. The scope of the try ... except
should be a unit from a semantic point of view. For example, if you
open a file and write some data to it, you could write:

 try:
 f = open("a.file", "w")
 except OSError as e:
 ... handle exception
 try:
 f.write("some")
 except OSError as e:
 ... handle exception
 try:
 f.write("data")
 except OSError as e:
 ... handle exception
 try:
 close(f)
 except OSError as e:
 ... handle exception

But not only is this hard to read and ugly as heck, what would be the
point?

Much better to write:

 try:
 with open("a.file", "w") as f:
 f.write("some")
 f.write("data")
 except OSError as e:
 ... handle exception

Or maybe don't catch it here at all but just let it bubble up until it
hits a level where dealing with it makes sense from the user's point of
view (who may not care about an individual file, but about the task they
instructed the program to perform).

 hp



I mean, you sort of want "the right amount of stuff" in a try block.  Lines that 
may exhibit a common failure, that you want to route to a common exception 
handler go into the same try block (per your example above).  Things that are 
going to raise unrelated errors for unrelated reasons should be in different try 
blocks.  Code that should only execute if the try block was error-free, but that 
you expect to not be able to raise errors itself, should go into the else block.


Like most of programming, hard-and-fast rules turn out to be impossible. 
Reality has squishy edges.


--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
--
https://mail.python.org/mailman/listinfo/python-list


[issue38680] PyGILState_Release does not release gil correctly, resulting in deadlock

2019-11-05 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I'm afraid it will be close to impossible to determine what's going on without 
a reproducer. 

There's not enough context in the issue to understand the report, in particular 
what the main thread is doing and how that's releasing the GIL. 

BTW. The code in msg356011 is too complex, it can be simplified to:

// START

class GIL_lock
{
public:
GIL_lock()
{
m_state = PyGILState_Ensure();
}

~GIL_lock()
{
   PyGILState_Release(m_state);
}

private:
PyGILState_STATE m_state;
};

// END

This is always safe, even if the thread currently owns the GIL. This will block 
when another thread owns the GIL, and will block forever when that other thread 
is not running Python code (and will therefore not release the GIL)

Is the problem also present with Python 3.8, or only 3.7? 

And for what it is worth, I don't have problems in my own code that uses these 
APIs.

--

___
Python tracker 

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



[issue38704] No `GetActiveProcessorCount` on Windows Vista

2019-11-05 Thread Zachary Ware


Zachary Ware  added the comment:

Added our 3.8 RM to adjust the download page.

Steve, can or should we adjust the installer to refuse to install on Vista?  Is 
there other documentation we need to adjust?

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

___
Python tracker 

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



Re: Pip not available

2019-11-05 Thread Terry Reedy

On 11/5/2019 5:22 AM, Ethan Woo wrote:


[image: image.png]


This, like most PSF lists, is text only.

--
Terry Jan Reedy

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


Re: permission denied using python 3.8

2019-11-05 Thread Terry Reedy

On 11/5/2019 12:26 PM, robin deatherage wrote:


Also there is no limit to how many different versions of Python you use on 
Windows---As long as you have a different UAC Control user logged in Windows 
for each one you add. I have 2.75, 3.5, 3.6, 3.7.0 and now 3.8 on my Windows 
now and all work fine. My user UAC logins may number five but that is is how it 
is suppose to be done anyways in Windows.


No it is not.  I and many people have multiple versions of versions of 
Python on one user account installed either for just that user or for 
all users.  The latter requires admin access.



--
Terry Jan Reedy

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


[issue38703] should we expect round(0.95, 1) to be 1.0, instead of 0.9?

2019-11-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

0.95 is actually 278419646001971/4503599627370496 which is smaller than 95/100.

>>> from fractions import Fraction
>>> Fraction(0.95)
Fraction(4278419646001971, 4503599627370496)
>>> Fraction(0.95) - Fraction(95, 100)
Fraction(-1, 22517998136852480)

It is closer to 0.9 than to 1.0.

>>> Fraction(0.95) - Fraction(0.9)
Fraction(450359962737049, 9007199254740992)
>>> Fraction(1) - Fraction(0.95)
Fraction(225179981368525, 4503599627370496)
>>> (Fraction(1) - Fraction(0.95)) - (Fraction(0.95) - Fraction(0.9))
Fraction(1, 9007199254740992)

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue38704] No `GetActiveProcessorCount` on Windows Vista

2019-11-05 Thread Arseniy


Arseniy  added the comment:

just tested, CPython 3.7.5 Successfully runs on Windows Vista.

--

___
Python tracker 

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



Re: How execute at least two python files at once when imported?

2019-11-05 Thread Terry Reedy

On 11/5/2019 1:33 PM, Spencer Du wrote:


I want to execute at least two python files at once when imported but I dont 
know how to do this. Currently I can only import each file one after another 
but what i want is each file to be imported at the same time. Can you help me 
write the code for this? embedded.py is the main file to execute.


[snip about 150 lines of example code]

We don't understand what you mean other than something impossible.  Your 
example code iswa   ytoo long.  It should be the minimum 
needed to illustrate the idea.


--
Terry Jan Reedy

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


[issue38693] Use f-strings instead of str.format within importlib

2019-11-05 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +eric.smith

___
Python tracker 

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



Re: OOP - how to abort an __init__ when the initialisation code fails ?

2019-11-05 Thread Peter J. Holzer
On 2019-11-04 18:18:39 -0300, Luciano Ramalho wrote:
> In addition, as Rob said, it is usually a bad idea to wrap several
> lines of code in a single try/except block

I disagree with this. While it is sometimes useful to wrap a single
line, in my experience it rarely is. The scope of the try ... except
should be a unit from a semantic point of view. For example, if you
open a file and write some data to it, you could write:

try:
f = open("a.file", "w")
except OSError as e:
... handle exception
try:
f.write("some")
except OSError as e:
... handle exception
try:
f.write("data")
except OSError as e:
... handle exception
try:
close(f)
except OSError as e:
... handle exception

But not only is this hard to read and ugly as heck, what would be the
point? 

Much better to write:

try:
with open("a.file", "w") as f:
f.write("some")
f.write("data")
except OSError as e:
... handle exception

Or maybe don't catch it here at all but just let it bubble up until it
hits a level where dealing with it makes sense from the user's point of
view (who may not care about an individual file, but about the task they
instructed the program to perform).

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38704] No `GetActiveProcessorCount` on Windows Vista

2019-11-05 Thread Arseniy


New submission from Arseniy :

This[https://www.python.org/downloads/windows/] page says "Note that Python 
3.8.0 cannot be used on Windows XP or earlier.". I tried to install it on 
Windows Vista and got a message that `GetActiveProcessorCount` is missing from 
`KERNEL32.DLL`. This message appears when running python.exe.
I don't think anyone besides me cares about Vista, so I'd change the text to: 
"Note that Python 3.8.0 requires Windows 7 or later". It's more positive this 
way ;)

--
messages: 356055
nosy: senyai
priority: normal
severity: normal
status: open
title: No `GetActiveProcessorCount` on Windows Vista
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



[issue38703] should we expect round(0.95, 1) to be 1.0, instead of 0.9?

2019-11-05 Thread Yudong Liu


New submission from Yudong Liu :

Python 3.7.0 (default, Aug 22 2018, 20:50:05) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> round(0.95,1)
0.9
>>> round(0.95)
1
>>> round(0.96,1)
1.0

--
components: Library (Lib)
messages: 356054
nosy: yudongliu
priority: normal
severity: normal
status: open
title: should we expect round(0.95,1) to be 1.0, instead of 0.9?
type: behavior
versions: Python 2.7, 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



Re: Friday finking: TDD and EAFP

2019-11-05 Thread Barry Scott



> On 1 Nov 2019, at 05:40, DL Neil via Python-list  
> wrote:
> 
> Is the practice of TDD fundamentally, if not philosophically, somewhat 
> contrary to Python's EAFP approach?
> 
> 
> TDD = Test-Driven Development
> EAFP = it's easier to ask forgiveness than permission
> * WebRefs as footnote
> 
> 
> The practice of TDD* is that one writes test routines to prove a unit of 
> code, eg method or function; BEFORE actually writing said function.
> 
> The rationale is that TDD encourages proper identification and consideration 
> of the routine's specification, and attempts to ensure that exceptions and 
> "edge-cases" are not quietly forgotten.
> (in a broad-brush, nut-shell)

The practice of creating software is a social activity where those involved
have foibles. Managing all the social interactions and foibles is what
the methodologies are trying to help with. Any methodology that is easier
to follow then avoid will tend to be taken up and provide a benefit.

We all know that tests are a must have, but often those tests that we all
know are a must have do not get written. It can often seem like a chore,
after all the code works right?

By starting with the tests the social engineering means that you make having
the tests the easy part of the process.

Methodologies like Agile address other foibles. Given a far off dead line
the tendency is to delay getting the bulk of the work done until at the last
moment.

So is TDD contrary to EAFP? Not as such its two sorts of social engineering.
TDD helps get the tests, EAPF give permission to take risks, necessary to
innovate.

Barry




> 
> However, I quite possibly like yourself, come from a time-before - before 
> TDD, and before Python. So, have had to not only learn these things, but 
> sometimes, un-learn points and habits (if not vices). Accordingly, I came 
> (quite unknowing of the term, or that there might be an alternative) from the 
> world of LBYL* (look before you leap).
> 
> In other words, before you do anything with some data, check that it is what 
> you think it is. Whereas in Python we "try" by assuming everything is 
> compos-mentis* and handle the "except" when things are not how we'd like.
> 
> That adaptation was not too difficult. After all, aren't programmers an 
> optimistic bunch - I mean, I *never* introduce bugs into *my* code! Do you?
> 
> Which brings us to TDD. Here we assume the likelihood of bugs, as-if (cue: 
> manic giggling); and code a bunch of tests first - in an attempt to prove 
> that the code is up-to-spec.
> 
> In encouraging my mind to think about testing the code, I find myself 
> searching for edge-cases, and attempting to anticipate the unusual. 
> Accordingly to the gospel of TDD: so far, so good.
> 
> The 'problem' is, that it puts my mind onto LBYL-rails before the 
> Python-coding train (of thought) has even left the station. It then seems 
> natural to start putting a bunch of if-then-else's up-front and before the 
> 'main line' of code.
> 
> Does TDD bend your mind in this (apparently) non-Pythonic fashion?
> Have you developed an answer?
> (other than: "@dn is 'nuts'*", which is not worthy of debate)
> 
> 
> WebRefs:
> https://duckduckgo.com/?q=TDD=web
> https://devblogs.microsoft.com/python/idiomatic-python-eafp-versus-lbyl/
> https://docs.python.org/3/glossary.html#term-eafp
> but: https://mail.python.org/pipermail/python-dev/2014-March/133118.html
> https://docs.python.org/3/glossary.html#term-lbyl
> Latin/legal term "compos mentis" 
> https://www.thefreedictionary.com/compos+mentis
> English slang term "nuts": https://www.thefreedictionary.com/nuts
> -- 
> Regards,
> =dn
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

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


[issue16575] ctypes: unions as arguments

2019-11-05 Thread Ammar Askar

Ammar Askar  added the comment:

Opened https://github.com/python/cpython/pull/17064 to fix this. Essentially 
it's a tiny little oversight in the back-porting. In the 3.7 branch, we perform 
an attribute lookup for `from_param` before the union checking code, so we must 
remember to DECREF it. This is unlike master where the attribute lookup happens 
after the union checking code.



λ win32\python_d.exe -m test -R 3:3 test_ctypes
0:00:00 Run tests sequentially
0:00:00 [1/1] test_ctypes
beginning 6 repetitions
123456
..

== Tests result: SUCCESS ==

1 test OK.

Total duration: 14.8 sec
Tests result: SUCCESS

--
nosy: +ammar2

___
Python tracker 

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



[issue38691] importlib: PYTHONCASEOK should be ignored when using python3 -E

2019-11-05 Thread Brett Cannon


Change by Brett Cannon :


--
nosy: +brett.cannon, eric.snow, ncoghlan

___
Python tracker 

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



[issue16575] ctypes: unions as arguments

2019-11-05 Thread Ammar Askar


Change by Ammar Askar :


--
pull_requests: +16572
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/17064

___
Python tracker 

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



Re: How execute at least two python files at once when imported?

2019-11-05 Thread Rhodri James

On 05/11/2019 18:33, Spencer Du wrote:

I want to execute at least two python files at once when imported but
I dont know how to do this. Currently I can only import each file one
after another but what i want is each file to be imported at the same
time.


That is a very odd requirement.  Why would you want to do this?  What 
exactly does "at the same time" mean here?


--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


Re: How execute at least two python files at once when imported?

2019-11-05 Thread Bob Gailer
On Nov 5, 2019 1:35 PM, "Spencer Du"  wrote:
>
> Hi
>
> I want to execute at least two python files at once when imported but I
dont know how to do this. Currently I can only import each file one after
another but what i want is each file to be imported at the same time. Can
you help me write the code for this?

Please explain what you mean by "imported at the same time". As far as I
know that is physically impossible.
-- 
https://mail.python.org/mailman/listinfo/python-list


Aw: How execute at least two python files at once when imported?

2019-11-05 Thread Karsten Hilbert
> I want to execute at least two python files at once when imported but I dont 
> know how to do this.
> Currently I can only import each file one after another but what i want is 
> each file to be imported
> at the same time.

Can you explain why that seems necessary ?

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


How execute at least two python files at once when imported?

2019-11-05 Thread Spencer Du
Hi

I want to execute at least two python files at once when imported but I dont 
know how to do this. Currently I can only import each file one after another 
but what i want is each file to be imported at the same time. Can you help me 
write the code for this? embedded.py is the main file to execute.

embedded.py
import paho.mqtt.client as mqtt
from mqtt2 import *
import os
import time
import json
import configparser
from threading import Thread

def start():
try:
os.remove("list_of_device(s)_currently_active.txt")
os.remove("laser.ini")
print("Awaiting device(s) to be activated")
except:
print("Awaiting device(s) to be activated")
start()

devices = list(map(str,input("Device(s) to be activated: ").split(",")))

client = embedded()
client.run()

client.loop_start()
print("Connected to broker")
time.sleep(1)
print("Subscribing to topic", "microscope/light_sheet_microscope/UI")
client.subscribe("microscope/light_sheet_microscope/UI")
print("Publishing message to topic", "microscope/light_sheet_microscope/UI")
client.publish("microscope/light_sheet_microscope/UI", json.dumps({"type": 
"system", "payload":{"name": devices, "cmd": "activating device(s)"}}, 
indent=2))
time.sleep(1)

def active_devices():
for item in devices:
device = (item + "Embedded")
deviceImport = __import__(device)

with open("list_of_device(s)_currently_active.txt", "a+") as myfile:
for item in devices:
myfile.write(item + "\n")
active_devices()

def readFile(fname):
print("List of device(s) currently active:")
try:
with open(fname, "r") as f:
for item in f:
print(item.rstrip("\n"))
except:
print("No device(s) added yet")
readFile("list_of_device(s)_currently_active.txt")

# print("Connected to broker")
# time.sleep(1)
# client.subscribe("microscope/light_sheet_microscope/UI/laser/#")
# if os.path.exists:
# parser = configparser.ConfigParser()
# parser.read("laser.ini")

# try:
# subscriptions = dict(parser.items("Subscriptions"))
# print("Subscribing to topics", subscriptions)
# client.subscribe(subscriptions)
# except:
# pass
# else:
# pass

client.loop_forever()

laserEmbedded.py
import random
import asyncio
from actorio import Actor, Message, DataMessage, ask, EndMainLoop, Reference
from mqtt2 import *

class Laser(Actor):
async def handle_message(self, message: Message):
print("Laser")
await asyncio.sleep(2)
print("Unitialised")
await asyncio.sleep(2)
print("Initialising")
await asyncio.sleep(2)
print("Initialised")
await asyncio.sleep(2)
print("Configuring")
await asyncio.sleep(2)
print("Configured")
await asyncio.sleep(2)
await message.sender.tell(DataMessage(data="Hello World Im a laser!" + 
"\n", sender=self))
async def main():
# Let's create an instance of a Greeter actor and start it. 
async with Laser() as laser:
# Then we'll just send it an empty message and wait for a response
reply : DataMessage = await ask(laser, Message())
print(reply.data)
asyncio.get_event_loop().run_until_complete(main())

def subscribe(): 
client = embedded()
client.run()

client.loop_start()
client.subscribe("microscope/light_sheet_microscope/UI/laser/#")
subscribe()

camerasEmbedded.py
import random
import asyncio
from actorio import Actor, Message, DataMessage, ask, EndMainLoop, Reference

class Cameras(Actor):
async def handle_message(self, message: Message):
print("Cameras")
await asyncio.sleep(2)
print("Unitialised")
await asyncio.sleep(2)
print("Initialising")
await asyncio.sleep(2)
print("Initialised")
await asyncio.sleep(2)
print("Configuring")
await asyncio.sleep(2)
print("Configured")
await asyncio.sleep(2)
await message.sender.tell(DataMessage(data="Hello World Im a camera!" + 
"\n", sender=self))
async def main():
# Let's create an instance of a Greeter actor and start it. 
async with Cameras() as cameras:
# Then we'll just send it an empty message and wait for a response
reply : DataMessage = await ask(cameras, Message())
print(reply.data)
asyncio.get_event_loop().run_until_complete(main())

filterwheelEmbedded.py
import random
import asyncio
from actorio import Actor, Message, DataMessage, ask, EndMainLoop, Reference

class FW(Actor):
async def handle_message(self, message: Message):
print("Filter wheel")
await asyncio.sleep(2)
print("Unitialised")
await asyncio.sleep(2)
print("Initialising")
await asyncio.sleep(2)
print("Initialised")
await asyncio.sleep(2)
print("Configuring")
await asyncio.sleep(2)
print("Configured")
await asyncio.sleep(2)

[issue38702] Adding new types to parser/unparse.py

2019-11-05 Thread Julin


Julin  added the comment:

Okay. 

But can lines like

if first:first = False
else: self.write(", ")

be changed to span across more number of lines?

Because things like

first:first

looks like a type hint.

--

___
Python tracker 

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



[issue38702] Adding new types to parser/unparse.py

2019-11-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

These types are obsolete. The compiler never generates an AST tree containing 
them.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue38702] Adding new types to parser/unparse.py

2019-11-05 Thread Julin


New submission from Julin :

The parser/unparse.py file lacks functions to handle the `Str`, `Num`, `Bytes` 
and `NameConstant` types.

Can we add them since it seems to be simple enough?

--
components: Demos and Tools
messages: 356050
nosy: ju-sh
priority: normal
severity: normal
status: open
title: Adding new types to parser/unparse.py
type: enhancement
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



[issue38699] socket: change listen() default backlog from 128 to 4096?

2019-11-05 Thread Ammar Askar


Ammar Askar  added the comment:

Just for some more reference points from "production" python web servers:

* gunicorn - 2048 
(https://github.com/benoitc/gunicorn/blob/678b326dc030b450717ec505df69863dcd6fb716/docs/source/settings.rst#backlog)

* tornado - 128 
(https://github.com/tornadoweb/tornado/blob/c50aed0f96d92f9b0ef4cd0837c0104f140ca77e/tornado/tcpserver.py#L178)

* uwsgi - 100 
(https://github.com/unbit/uwsgi/blob/3149df02ed443131c54ea6afb29fcbb0ed4d1139/core/init.c#L115)

--
nosy: +ammar2

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-05 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

Yes, I will be submitting followup changes for pidfd_send_signal and the other 
goodies.

I would like to use pidfds in subprocess, but as you as you say, that's another 
kettle of fish.

--

___
Python tracker 

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



Re: permission denied using python 3.8

2019-11-05 Thread robin deatherage
On Tuesday, November 5, 2019 at 10:06:49 AM UTC+8, Francois van Lieshout wrote:
> Hi, i installed python 3.8 the latest version but it doesn’t work, i get 
> “permission denied” when trying to acces python in the CLI and also i can’t 
> run my code from my python files in the command-line nor in IDLE. I’d like to 
> know why this is so. I’ve tried the 64 bit and the 32 bit executable version 
> of 3.8 but without succes. So i reinstalled version 3.7.2 and now everything 
> works fine again.
> 
> Can you tell me why i can’t use python 3.8, i’m using windows as OS.

YES---MS Windows uses a UAC User Control. So it is best to not add a package to 
an Admin user on Windows. Now in answer to this question first either your 
python interpreter remained in the system32 directory or you have an installed 
software using another version of an interpreter also located in the system 
directory interfering. 

And as pointed out with the UAC User Control on Windows. Log out of the current 
Windows User or Admin. Log into another Windows new user and add a different 
version of Python. But if you installed any Python in the Admin you will have 
to delete all traces of Python and or any interpreters to do so.

Also there is no limit to how many different versions of Python you use on 
Windows---As long as you have a different UAC Control user logged in Windows 
for each one you add. I have 2.75, 3.5, 3.6, 3.7.0 and now 3.8 on my Windows 
now and all work fine. My user UAC logins may number five but that is is how it 
is suppose to be done anyways in Windows.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38692] add a pidfd child process watcher

2019-11-05 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

Thanks for the CC.

It would be nice to get `pidfd_send_signal` as well, while we're at it. But 
that could be a separate PR.

AFAICT the other bits of the pidfd API right now are some extra flags to clone, 
and an extra flag to waitid. The waitid flag is nice-to-have but not really 
urgent, since it's easy enough to use a flag even if the stdlib doesn't 
explicitly expose it. The clone flags are super interesting, but before we can 
use them, we need to have some way to access clone itself, and that's a big 
complicated project, so we definitely shouldn't worry about it here.

--

___
Python tracker 

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



Re: Is there some python libary for edit iso file drectly?

2019-11-05 Thread robin deatherage
On Tuesday, November 5, 2019 at 7:11:30 AM UTC+8, Hongyi Zhao wrote:
> Is there some python libary for edit iso file drectly?

You can use batch .bat files and have Python execute them. Honestly Batch will 
do all you are asking on MS Windows. Use its XCOPY to copy the IO file or the 
entire IO Directory, move or copy it to another directory as a non IO. Then 
have the batch make changes to the file then save it where and as you wish back 
to an IO.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38701] datetime.timedelta string representation is ambiguous

2019-11-05 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +belopolsky, p-ganssle

___
Python tracker 

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



[issue38360] single-argument form of -isysroot should be supported

2019-11-05 Thread Joshua Root


Joshua Root  added the comment:

Ping?

--

___
Python tracker 

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



[issue37645] Replace PyEval_GetFuncName/PyEval_GetFuncDesc

2019-11-05 Thread miss-islington


miss-islington  added the comment:


New changeset bf17d41826a8bb4bc1e34ba6345da98aac779e41 by Miss Islington (bot) 
(Jeroen Demeyer) in branch 'master':
bpo-37645: add new function _PyObject_FunctionStr() (GH-14890)
https://github.com/python/cpython/commit/bf17d41826a8bb4bc1e34ba6345da98aac779e41


--
nosy: +miss-islington

___
Python tracker 

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



Re: Pip not available

2019-11-05 Thread Pankaj Jangid
Ethan Woo  writes:

> I was using Python 3.7.4 for a project, and I needed to install the
> *playsound* function. I looked through online and saw that I needed to use
> pip. However, it didn't work. I looked online and saw that I needed to
> install it through the application, however, now this problem pops up.
> [image: image.png]
> Can you help me with this?
>
python3 -m pip install 

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


[issue38655] ipaddress.ip_network('0.0.0.0/0').is_private == True

2019-11-05 Thread Pete Wicken


Pete Wicken  added the comment:

Looks like this happens because the is_private method that gets called is from 
_BaseNetwork, which checks if the network address '0.0.0.0' and the broadcast 
address '255.255.255.255' are both private, which they are as 0.0.0.0 falls 
into 0.0.0.0/8.

I think for this to get it right, you would have to change the is_private check 
for networks to iterate over each possible subnet and check if that is in the 
private networks list. This takes an unfeasibly long time.

So, we would probably have to add special cases for these networks, unless 
people have better ideas.

--
nosy: +Wicken

___
Python tracker 

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



[issue35381] posixmodule: convert statically allocated types (DirEntryType & ScandirIteratorType) to heap-allocated types

2019-11-05 Thread miss-islington


miss-islington  added the comment:


New changeset b3966639d28313809774ca3859a347b9007be8d2 by Miss Islington (bot) 
(Eddie Elizondo) in branch 'master':
bpo-35381 Remove all static state from posixmodule (GH-15892)
https://github.com/python/cpython/commit/b3966639d28313809774ca3859a347b9007be8d2


--
nosy: +miss-islington

___
Python tracker 

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



[issue38700] typo in unittest mock docs

2019-11-05 Thread Arunkumar Mani


Arunkumar Mani  added the comment:

my bad. i misread the docs. you are right

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



[issue38701] datetime.timedelta string representation is ambiguous

2019-11-05 Thread Serge Matveenko


New submission from Serge Matveenko :

Negative `timedelta` string representation is ambiguous.

```
>>> from datetime import datetime, timedelta
>>> d2 = datetime.now()
>>> d1 = d2 - timedelta(days=42, seconds=5)
>>> str(d2 - d1)
'42 days, 0:00:05'
>>> str(d1 - d2)
'-43 days, 23:59:55'
```

I would expect `str(d1 - d2)` to be one of the following:
* '-42 days, 0:00:05'
* '-(42 days, 0:00:05)'
* '- 42 days, 0:00:05'

--
components: Library (Lib)
messages: 356041
nosy: lig
priority: normal
severity: normal
status: open
title: datetime.timedelta string representation is ambiguous
type: behavior
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



[issue38700] typo in unittest mock docs

2019-11-05 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Can you please add the specific piece of text? There is an illustration to say 
that it's common mistake to type assret instead of assert with which mock gives 
a new child mock. This can be made stricter with unsafe mode to detect this 
typo.

--
nosy: +xtreak

___
Python tracker 

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



Re: __instancecheck__ metaclasses, how do they work: why do I get True when I tuple, why doesn't print run?

2019-11-05 Thread Pieter van Oostrum
Chris Angelico  writes:

> On Tue, Nov 5, 2019 at 5:43 PM dieter  wrote:
>> I suppose that "isinstance" (at least under Python 2) does not
>> behave exactly as stated in PEP 3119. Instead, "isinstance"
>> first directly checks for the instance to be an instance of the
>> class *AND ONLY IF THIS FAILS* calls the class' "__instancecheck__".
>
> PEP 3119 is specifically about Python 3.0; I don't know how much, if
> any, was backported into Python 2.

Yes, it has been there since Python 2.6.

I looked in the implementation, and isinstance(inst, cls) first checks if the 
class of ins is cls, then the result is True.
There are a few other shortcut cases, and only at the end the __instancecheck__ 
method is called.

You can check this with the original example:

In [88]: class MA(type):
...:   def __instancecheck__(cls, inst):
...: print "MA", cls, inst
...: 
...: class AM(list): __metaclass__ = MA
...: class AM2(AM): pass
...: 
...: am = AM2()

In [89]: isinstance(am, AM)
MA  []
Out[89]: False

It returns False because __instancecheck__ returns None

Same for Python3:

In [8]: class MA(type):
   ...:   def __instancecheck__(cls, inst):
   ...: print ("MA", cls, inst)
   ...: 
   ...: class AM(list, metaclass = MA): pass
   ...: class AM2(AM): pass
   ...: 
   ...: am = AM2()

In [9]: isinstance(am, AM)
MA  []
Out[9]: False

-- 
Pieter van Oostrum 
WWW: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


Pip not available

2019-11-05 Thread Ethan Woo
Dear person reading this,
I was using Python 3.7.4 for a project, and I needed to install the
*playsound* function. I looked through online and saw that I needed to use
pip. However, it didn't work. I looked online and saw that I needed to
install it through the application, however, now this problem pops up.
[image: image.png]
Can you help me with this?

*P.S. I am a schoolkid who needs some help, not very experienced.*
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38692] add a pidfd child process watcher

2019-11-05 Thread Benjamin Peterson


Change by Benjamin Peterson :


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

___
Python tracker 

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



  1   2   >