[issue42189] copy.deepcopy() no longer works on platform.uname_result objects

2020-10-28 Thread Robert O'Callahan


New submission from Robert O'Callahan :

Starting from Python 3.9, copy.deepcopy can't copy a platform.uname_result 
object.

```
Python 3.9.0 (default, Oct  6 2020, 00:00:00) 
[GCC 10.2.1 20200826 (Red Hat 10.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> import copy
>>> u = platform.uname()
>>> print(u)
uname_result(system='Linux', node='localhost.localdomain', 
release='5.8.16-300.fc33.x86_64', version='#1 SMP Mon Oct 19 13:18:33 UTC 
2020', machine='x86_64')
>>> v = copy.deepcopy(u)
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python3.9/copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
  File "/usr/lib64/python3.9/copy.py", line 264, in _reconstruct
y = func(*args)
  File "/usr/lib64/python3.9/copyreg.py", line 91, in __newobj__
return cls.__new__(cls, *args)
TypeError: () takes 6 positional arguments but 7 were given
```

Looks similar to issue 42163 but I guess it might need to be fixed differently.

This has broken building Intel's Xed library, which uses a Python-based build 
system: https://github.com/intelxed/mbuild

--
components: Library (Lib)
messages: 379853
nosy: rocallahan
priority: normal
severity: normal
status: open
title: copy.deepcopy() no longer works on platform.uname_result objects
type: behavior
versions: Python 3.10, Python 3.9

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



[issue42163] _replace() no longer works on platform.uname_result objects

2020-10-28 Thread Robert O'Callahan


Robert O'Callahan  added the comment:

I filed issue 42189, which is similar but maybe worse: copy.deepcopy() is 
broken for platform.uname_result objects.

--
nosy: +rocallahan

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



[issue18544] subprocess.Popen support for redirection of arbitrary file descriptors

2013-07-24 Thread Robert O'Callahan

New submission from Robert O'Callahan:

Popen() ought to support redirection to/from more file descriptors than 0, 1, 
and 2 when spawning processes. A clear use case is here: 
http://stackoverflow.com/questions/6050187/write-to-file-descriptor-3-of-a-python-subprocess-popen-object

Instead of messing around with os.open() and os.close() calls, my proposed API 
for Popen would be to accept keyword arguments fdN that would take the same 
type of values as the stdin, stdout, stderr arguments. Conflicting fd0 and 
stdin arguments would throw an exception.

So the smelly code in the above SO question would be changed to:


cmd='gpg --passphrase-fd {fd} -c'.format(fd=fd)
with open('passphrase.txt','r') as fd3_fh:
with open('filename.txt','r') as stdin_fh:
with open('filename.gpg','w') as stdout_fh:
proc=subprocess.Popen(shlex.split(cmd),
  stdin=stdin_fh,
  stdout=stdout_fh,
  fd3=fd3_fh)
proc.communicate()

--
components: Library (Lib)
messages: 193646
nosy: ropoctorix
priority: normal
severity: normal
status: open
title: subprocess.Popen support for redirection of arbitrary file descriptors
type: enhancement

___
Python tracker 
<http://bugs.python.org/issue18544>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com