[issue14156] argparse.FileType for '-' doesn't work for a mode of 'rb'

2017-05-05 Thread Matteo Bertini

Matteo Bertini added the comment:

Bumped in this bug yesterday, sadly a script working (by chance) in Python2 
doesn't work in Python3 because of this bug.

--
nosy: +naufraghi

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



[issue23246] distutils fails to locate vcvarsall with Visual C++ Compiler for Python

2016-12-15 Thread Matteo Bertini

Matteo Bertini added the comment:

I'm back on this issue with a minimal patch, and a longer motivation.

Distutils does not support Visual C++ for Python compiler, but it could, with a 
one-line patch.

The proposed workaround is to use `setuptools`. But, we are not alone in this 
World, am I supposed to fork each third party package still using `distutils` 
and upgrade them to `setuptools`?

No, someone will say, you can "simply" `import setuptools`, and it will 
monkey-patch `distutils` adding the support for VS for Python.

1) this is implicit, very very against the Python Zen
2) the modifications are not limited and back-compatible. Some packages, say 
`sip` from `PyQt`, are broken simply adding this `import setuptools`, and other 
are too.

That said, I think this minimal patch to the `find_vcvarsall` code, can save a 
lot of time to every Python 2.7 users, time I see better spent upgrading to 
Python 3.

Sorry for the rant-mode, but I very liked Python, and I still like Python more 
than other languages, but I don't think that providing half broken solutions 
and very limited support to all the developer still running Python 2.7 in some 
big old project is a good strategy to push people to Python 3.

Python 3 is already a better language, but Python as a language can be a better 
language only if Python 2.7 will be a first class citizen till 2020.

--
keywords: +patch
nosy: +naufraghi
type:  -> enhancement
Added file: http://bugs.python.org/file45916/vsforpython.diff

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



[issue7111] core dump when stderr is moved

2009-10-24 Thread Matteo Bertini

Changes by Matteo Bertini matt...@naufraghi.net:


--
nosy: +naufraghi

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7111
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7111] stdout closed

2009-10-24 Thread Matteo Bertini

Changes by Matteo Bertini matt...@naufraghi.net:


--
title: core dump when stderr is moved - stdout closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7111
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7111] core dump when stderr is moved

2009-10-24 Thread Matteo Bertini

Matteo Bertini matt...@naufraghi.net added the comment:

sorry, title restored!

--
title: stdout closed - core dump when stderr is moved

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7111
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1488934] file.write + closed pipe = no error

2009-10-24 Thread Matteo Bertini

Changes by Matteo Bertini matt...@naufraghi.net:


--
nosy: +naufraghi
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1488934
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1596] Broken pipes should be handled better in 2.x

2009-10-24 Thread Matteo Bertini

Changes by Matteo Bertini matt...@naufraghi.net:


--
nosy: +naufraghi

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1596
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5779] _elementtree import can fail silently

2009-04-17 Thread Matteo Bertini

New submission from Matteo Bertini matt...@naufraghi.net:

(the patch is old, I forwarded it to Fredrik but I forgot to open the bug)

Playing with PyInstaller I have found that the final part of _elementtree.c:

Index: Modules/_elementtree.c
===
--- Modules/_elementtree.c  (revisione 59540)
+++ Modules/_elementtree.c  (copia locale)
@@ -2780,7 +2780,10 @@

);

-PyRun_String(bootstrap, Py_file_input, g, NULL);
+if (PyRun_String(bootstrap, Py_file_input, g, NULL) == NULL) {
+m = PyErr_Occurred();
+return;
+}

 elementpath_obj = PyDict_GetItemString(g, ElementPath);

executes a bit of python code without checking the return value.
That can lead to weird things playing with import hooks,
for example an assert like this can fail:

Index: Lib/test/test_elemettree.py
===
--- Lib/test/test_elemettree.py (revisione 0)
+++ Lib/test/test_elemettree.py (revisione 0)
@@ -0,0 +1,21 @@
+#! /usr/bin/env python
+
+def importHook(*args, **kwargs):
+if 'xml.etree' in args:
+raise ImportError
+else:
+return __real__import__(*args, **kwargs)
+
+import os
+import __builtin__
+__real__import__ = __builtin__.__import__
+__builtin__.__import__ = importHook
+
+try:
+import xml.etree.cElementTree as cET
+except ImportError:
+pass
+else:
+out = os.popen(python -c 'import xml.etree.cElementTree as cET;
print dir(cET)').read().strip()
+assert str(dir(cET)) == out, (str(dir(cET)), out)
+

Quite a novice with python internals, so comments are welcome.
Matteo Bertini

--
components: XML
messages: 86062
nosy: naufraghi
severity: normal
status: open
title: _elementtree import can fail silently

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5779
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5779] _elementtree import can fail silently

2009-04-17 Thread Matteo Bertini

Matteo Bertini matt...@naufraghi.net added the comment:

Ups, I duplicated myself... issue3475

--
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5779
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1068268] subprocess is not EINTR-safe

2008-12-24 Thread Matteo Bertini

Changes by Matteo Bertini matt...@naufraghi.net:


Removed file: 
http://bugs.python.org/file11818/subprocess-retry-on-EINTR-std-in-out-err.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1068268
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1068268] subprocess is not EINTR-safe

2008-12-24 Thread Matteo Bertini

Changes by Matteo Bertini matt...@naufraghi.net:


Removed file: 
http://bugs.python.org/file11511/subprocess-eintr-safety-25maint-r65475.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1068268
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1068268] subprocess is not EINTR-safe

2008-12-24 Thread Matteo Bertini

Matteo Bertini matt...@naufraghi.net added the comment:

no EINTR patch upgraded to 25-maint r65475 that protects:

*) all direct calls
*) all returned fd

I hope :P

Added file: 
http://bugs.python.org/file12438/no-EINTR-subprocess.py-25-maint-r65475.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1068268
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1068268] subprocess is not EINTR-safe

2008-12-23 Thread Matteo Bertini

Matteo Bertini matt...@naufraghi.net added the comment:

Please have a look at the proposed patch:

http://bugs.python.org/file11511/subprocess-eintr-safety-25maint-
r65475.patch

the list is more or less the patch itself.

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1068268
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3588] sysconfig variable LINKFORSHARED has wrong value for MacOS X framework build

2008-11-05 Thread Matteo Bertini

Matteo Bertini [EMAIL PROTECTED] added the comment:

I can add that providing the option:

-mmacosx-version-min=10.4

or setting the anv var

MACOSX_DEPLOYMENT_TARGET=10.4

is it possible to build an extension in MacPython.org too
(without that option there was a problem with some 10.5 libs)

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3588
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3588] sysconfig variable LINKFORSHARED has wrong value for MacOS X framework build

2008-11-04 Thread Matteo Bertini

Matteo Bertini [EMAIL PROTECTED] added the comment:

I confirm this issue, some handy workaround available?

--
nosy: +naufraghi

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3588
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3588] sysconfig variable LINKFORSHARED has wrong value for MacOS X framework build

2008-11-04 Thread Matteo Bertini

Matteo Bertini [EMAIL PROTECTED] added the comment:

The solution I found is:

LINKFORSHARED = -u _PyMac_Error -framework Python

as in the Apple included Python Makefile

and

LDFLAGS += -F$(PYTHONFRAMEWORKPREFIX)

that makes linker use the right framework (not sure, but works with
MacPython installed)

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3588
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1068268] subprocess is not EINTR-safe

2008-10-17 Thread Matteo Bertini

Matteo Bertini [EMAIL PROTECTED] added the comment:

Factorized try-except code, merged r65475 from 25-maint.
Protetect std[in|out|err] read and write too.

Added file: 
http://bugs.python.org/file11818/subprocess-retry-on-EINTR-std-in-out-err.diff

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1068268
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1068268] subprocess is not EINTR-safe

2008-10-17 Thread Matteo Bertini

Matteo Bertini [EMAIL PROTECTED] added the comment:

Ups, forgot a _no_intr around select.select

Index: subprocess.py
===
--- subprocess.py   (revisione 19645)
+++ subprocess.py   (copia locale)
@@ -1178,7 +1178,7 @@
 
 input_offset = 0
 while read_set or write_set:
-rlist, wlist, xlist = select.select(read_set, 
write_set, [])
+rlist, wlist, xlist = _no_intr(select.select)(read_set, 
write_set, [])
 
 if self.stdin in wlist:
 # When select has indicated that the file is 
writable,

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1068268
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4017] IDLE 2.6 broken on OSX (Leopard)

2008-10-12 Thread Matteo Bertini

Matteo Bertini [EMAIL PROTECTED] added the comment:

I have the same error as in msg74221
RuntimeError: tk.h version (8.4) doesn't match libtk.a version (8.5)

Some workaround not involving a full rebuild?

--
nosy: +naufraghi

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4017
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1068268] subprocess is not EINTR-safe

2008-09-17 Thread Matteo Bertini

Matteo Bertini [EMAIL PROTECTED] added the comment:

Upgrade subprocess.py patch to 25-maint r65475
(apply cleanly with http://bugs.python.org/issue2113 fixed)

--
keywords: +patch
Added file: 
http://bugs.python.org/file11511/subprocess-eintr-safety-25maint-r65475.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1068268
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1068268] subprocess is not EINTR-safe

2008-09-05 Thread Matteo Bertini

Matteo Bertini [EMAIL PROTECTED] added the comment:

I'd like to suggest to rise the priority of this bug.
Till this bus is around, no way using any module using subprocess.Popen 
form a PyQt app (and I suppose PyGtk and wxPython too).

--
nosy: +naufraghi

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1068268
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3475] _elementtree.c import can fail silently

2008-07-31 Thread Matteo Bertini

New submission from Matteo Bertini [EMAIL PROTECTED]:

Playing with PyInstaller I have found that the final part of 
_elementtree.c:

Index: Modules/_elementtree.c
===
--- Modules/_elementtree.c  (revisione 59540)
+++ Modules/_elementtree.c  (copia locale)
@@ -2780,7 +2780,10 @@

   );

-PyRun_String(bootstrap, Py_file_input, g, NULL);
+if (PyRun_String(bootstrap, Py_file_input, g, NULL) == NULL)
+return;

elementpath_obj = PyDict_GetItemString(g, ElementPath);

execute a bit of python code without checking the return value.
That can lead to weird things playing with import hooks,
for example an assert like this can fail:

Index: Lib/test/test_elemettree.py
===
--- Lib/test/test_elemettree.py (revisione 0)
+++ Lib/test/test_elemettree.py (revisione 0)
@@ -0,0 +1,21 @@
+#! /usr/bin/env python
+
+def importHook(*args, **kwargs):
+if 'xml.etree' in args:
+raise ImportError
+else:
+return __real__import__(*args, **kwargs)
+
+import os
+import __builtin__
+__real__import__ = __builtin__.__import__
+__builtin__.__import__ = importHook
+
+try:
+import xml.etree.cElementTree as cET
+except ImportError:
+pass
+else:
+out = os.popen(python -c 'import xml.etree.cElementTree as cET; 
print dir(cET)').read().strip()
+assert str(dir(cET)) == out, (str(dir(cET)), out)
+

--
components: XML
messages: 70488
nosy: naufraghi
severity: normal
status: open
title: _elementtree.c import can fail silently
versions: Python 2.5

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3475
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com