[issue31443] Possibly out of date C extension documentation

2017-09-13 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

On Windows at least: I think "another C module" should be understood as 
"another DLL or executable".

A user extension module is a different DLL from the core Python, so the advice 
is still valid.

--
nosy: +amaury.forgeotdarc

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



[issue26750] Mock autospec does not work with subclasses of property()

2016-08-17 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

inspect.isdatadescriptor() is better indeed.
(I was initially working on an old version of mock.py which does not import 
inspect, and I did not want to add the dependency there).

- inspect uses hasattr(type(obj)) instead of hasatr(obj). This is better, (but 
does not work for 2.x old-style classes)

- my patch tested for __del__... this is completely wrong, it should have been 
__delete__. oops.
inspect.isdatadescriptor() does not test for __delete__. This is insaccurate, 
but I doubt it will ever matter. This is only possible for Python-defined 
descriptors, the C implementation always exposes both __set__ and __delete__ 
when tp_set is filled.

IOW, I'm happy with the current state.

--

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



[issue26750] Mock autospec does not work with subclasses of property()

2016-05-18 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Updated patch with review comments.

--
Added file: http://bugs.python.org/file42891/mock-descriptor-2.patch

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



[issue26750] Mock autospec does not work with subclasses of property()

2016-04-13 Thread Amaury Forgeot d'Arc

New submission from Amaury Forgeot d'Arc:

When patching a class, mock.create_autospec() correctly detects properties and 
__slot__ attributes, but not subclasses of property() or other kinds of data 
descriptors.

The attached patch detects all data descriptors and patch them the way they 
should be.

--
components: Tests
files: mock-descriptor.patch
keywords: patch
messages: 263361
nosy: amaury.forgeotdarc, michael.foord
priority: normal
severity: normal
status: open
title: Mock autospec does not work with subclasses of property()
type: enhancement
Added file: http://bugs.python.org/file42458/mock-descriptor.patch

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



[issue26060] Class __dict__ iteration order changing due to type instance key-sharing

2016-01-12 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Indeed. Here is another version of the script, it crashes when I set 
PYTHONHASHSEED=1 and passes with PYTHONHASHSEED=3::

class Meta(type):
def __new__(meta, clsname, bases, methods):
cls = super(Meta, meta).__new__(meta, clsname, bases, methods)
count = 0
for name in vars(cls):
if name.startswith('f_'):
print('decorate', name)
count += 1
setattr(cls, name, getattr(cls, name))
assert count == 8
return cls

class Spam2(metaclass=Meta):
def f_1(self): pass
def f_2(self): pass
def f_3(self): pass
def f_4(self): pass
def f_5(self): pass
def f_6(self): pass
def f_7(self): pass
def f_8(self): pass

--
nosy: +amaury.forgeotdarc

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



[issue24390] Python 3.4.3 64 bits is not high dpi aware

2015-06-09 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

The Python program itself has no UI and cannot be marked as DPI aware.

Instead, applications should call the win32 function SetProcessDPIAwareness: 
https://msdn.microsoft.com/en-us/library/windows/desktop/dn302122

--
nosy: +amaury.forgeotdarc

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



[issue22681] Add support of KOI8-T encoding

2015-05-12 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Looks good to me.

--
nosy: +amaury.forgeotdarc

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



[issue22682] Add support of KZ1048 (RK1048) encoding

2015-05-12 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Please go ahead! Or do you expect someone else to review the patch?

--

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



[issue23275] Can assign [] = (), but not () = []

2015-04-22 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

About the patch: I'm sure there are other tests to change,
in test_syntax.py for example::

It's a syntax error to assign to the empty tuple.  Why isn't it an
error to assign to the empty list?  It will always raise some error  at
runtime.

 () = 1
Traceback (most recent call last):
  File doctest test.test_syntax[3], line 1
SyntaxError: can't assign to ()

--
nosy: +amaury.forgeotdarc

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



[issue23815] Segmentation fault when create _tkinter objects

2015-04-08 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Probably a PyType_Ready() missing.

--

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



[issue23830] Add AF_IUCV support to sockets

2015-04-01 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Hi,
First, please fill and submit a Contribution Agreement: 
https://www.python.org/psf/contrib/

Then about the patch:
- This is a patch against Python2.7, which is frozen for new developments. This 
change will only be applied to python 3.5 or later.
- There are some tab characters in the diff
- Names are limited to 8 characters, but there is no check.
- Names must be padded with spaces. This is done automatically in connect(), 
but these extra spaces should be removed in makesockaddr() so that the same 
names are returned.

--
nosy: +amaury.forgeotdarc

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



[issue21526] Support new booleans in Tkinter

2015-03-31 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Ah, the NULL case is indeed tested just above. So the current code works 
correctly.

--
resolution:  - fixed
status: open - closed

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



[issue21526] Support new booleans in Tkinter

2015-03-31 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

I'm not sure that this change is correct.
I have Tcl version 8.6 installed, and I checked that app-BooleanType is NULL.

Fortunately value-typePtr is probably never NULL, but I think the comparison 
should be skipped in this case.

Where did you see this booleanString?

--
nosy: +amaury.forgeotdarc
resolution: fixed - 
status: closed - open

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



[issue23720] __del__() order is broken since 3.4.0

2015-03-20 Thread Amaury Forgeot d'Arc

Changes by Amaury Forgeot d'Arc amaur...@gmail.com:


--
nosy: +pitrou

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



[issue23720] __del__() order is broken since 3.4.0

2015-03-20 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Actually there *is* a cycle:
  assert a.vector is a.vector.device.__class__.__del__.__globals__['a'].vector

A workaround is to not store objects with __del__ in module globals...
Or have only one (the Main instance in your case)

--
nosy: +amaury.forgeotdarc

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



[issue23419] Faster default __reduce__ for classes without __init__

2015-03-19 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

But isn't the result different?
NEWOBJ calls cls.__new__() and __init__ is skipped.
REDUCE calls cls(): both __new__ and __init__ are used.

--
nosy: +amaury.forgeotdarc

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



[issue23419] Faster default __reduce__ for classes without __init__

2015-03-19 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Sorry, I missed the important point:
for classes without __init__

--

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



[issue23643] Segmentation Fault with Large Simple Function

2015-03-12 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

So the recursion crash was fixed in python3,
but it's still one of the limits of the Python AST compiler.

I suggest to replace your long expression by a list:
  exprs = [(1-a36)*(a37)*(1-a41), (a22)*(a33)*(1-a23), ...]
  return sum(exprs)

...but this function requires large storage at runtime, on the Python stack, 
and for the list.
Maybe better:
  loopcount = 0
  loopcount += (1-a36)*(a37)*(1-a41)
  ...
  return loopcount

--

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



[issue23643] Segmentation Fault with Large Simple Function

2015-03-11 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Probably a stack overflow, when the AST is too deep:
eval(+1 * 748580) also crashed for me

--
nosy: +amaury.forgeotdarc

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



[issue23590] Potential leak in PyFloat_AsDouble. Refcount error.

2015-03-05 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Simple script to reproduce the issue:

import sys, time
class C(object):
  def __float__(self):
return 
for x in range(1):
  try:
time.sleep(C())
  except TypeError:
pass
  if x % 1000 == 0:
print(sys.getrefcount())

--
nosy: +amaury.forgeotdarc

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



[issue23438] HTMLParser doesn't know how to deal with 'ampersand'

2015-02-10 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

amp; is an entity reference.
Either pass convert_charrefs=True to the constructor, or implement a method 
def handle_entityref(self, data) to receive them as events.

https://docs.python.org/3.4/library/html.parser.html

--
nosy: +amaury.forgeotdarc
resolution:  - not a bug
status: open - closed

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



[issue21862] cProfile command-line should accept -m module_name as an alternative to script path

2015-01-23 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

This change will cause the module to be imported twice:
progname = runpy.run_module(args[0])['__file__']
... and then the runctx() call.

What about something like:
code = runpy.run_module(modname, run_name='__main__')
globs = { 'runpy': runpy, 'modname': args[0] }

--

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



[issue21862] cProfile command-line should accept -m module_name as an alternative to script path

2014-12-19 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

The patch does not seem to allow parameters after the -m option.
I'm sure this restriction can be lifted.

--
nosy: +amaury.forgeotdarc

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



[issue23020] New matmul operator crashes modules compiled with CPython3.4

2014-12-10 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

PEP384 is presented as a new way to write modules that can be loaded by 
multiple Python versions, specially on Windows.
I could not find any place that says that modules not using the stable ABI need 
to be recompiled.

I'm not against changing this rule (after all, I started on Windows platform 
where all this discussion does not apply), but it should be clearly stated 
somewhere in the API docs, and also in the whatsnew pages (all of them?)

--

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



[issue23020] New matmul operator crashes modules compiled with CPython3.4

2014-12-09 Thread Amaury Forgeot d'Arc

New submission from Amaury Forgeot d'Arc:

When an extension module is compiled with CPython3.4, the nb_matrix_multiply 
slot is not filled, and no memory is allocated for it.
If the extension module is imported by CPython3.5, nb_matrix_multiply contains 
garbage and segfaults the interpreter.

In Python 2.7 there are flags like Py_TPFLAGS_HAVE_INDEX to gate the access  to 
recently added slots. I think Python3.5 should have a similar one.

--
messages: 232372
nosy: amaury.forgeotdarc, benjamin.peterson
priority: normal
severity: normal
status: open
title: New matmul operator crashes modules compiled with CPython3.4
type: crash

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



[issue23020] New matmul operator crashes modules compiled with CPython3.4

2014-12-09 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Here is a test module that segfaults on Python3.5.
It's derived from _testcapi, but it can be anything with a PyNumberMethods.

I compiled with
gcc -g -I path/to/cpython3.4/Include/ -I /path/to/cpython3.4 mytest.c -fPIC 
--shared -o mytest.so

Then I ran python3.5 and:
import mytest
print(mytest.matmulType() @ 1)

When the module is compiled with 3.5, TypeError is correctly raised.

--
Added file: http://bugs.python.org/file37397/mytest.c

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



[issue23020] New matmul operator crashes modules compiled with CPython3.4

2014-12-09 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Oh, has this ABI compatibility requirement changed from the 2.x series?

--

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



[issue23020] New matmul operator crashes modules compiled with CPython3.4

2014-12-09 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

I would not mind the change, but I've always thought the opposite (except on 
Windows, where the string Python27.dll is stored in the .pyd)

There are traces of this binary compatibility still today in the 3.4 headers:
https://hg.python.org/cpython/file/v3.4.0/Include/pymem.h#l23
...if you do use the macros you must recompile your extensions with each 
Python release...
Which seems to imply that extensions usually don't need to be recompiled!

--

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



[issue22999] Copying emoji to Windows clipboard corrupts string in Python 3.3 and up

2014-12-05 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

(you swapped the unicode values: \U0001f4cb is copied as \U0001f400)

On Windows, strings have changed in 3.3. See in 
https://docs.python.org/3/whatsnew/3.3.html, len() now always returns 1 for 
non-BMP characters.

The call to GlobalAlloc should use the number of wchar_t units, something like 
len(data.encode('utf-16')) + 2

--
nosy: +amaury.forgeotdarc
resolution:  - not a bug
status: open - closed

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



[issue22999] Copying emoji to Windows clipboard corrupts string in Python 3.3 and up

2014-12-05 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Better use utf-16-le encoding:
  len(data.encode('utf-16-le')) + 2
otherwise the encoded bytes start with the \fffe BOM.

--

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



[issue22982] BOM incorrectly inserted before writing, after seeking in text file

2014-12-02 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

issue5006 was supposed to take care of this, but it has a flaw IMO:
This statement 
https://hg.python.org/cpython/file/0744ceb5c0ed/Lib/_pyio.py#l2003 is missing 
an and whence!=2.

--
nosy: +amaury.forgeotdarc

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



[issue22961] ctypes.WinError OSError

2014-11-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

No, OSError.errno is converted from the Windows error code.

There is a translation map (see PC/errmap.h, built with the _dosmaperr() 
function) and the default value is EINVAL.

It's working as intended. What was the winerror code? do you think it should be 
mapped to another errno?

--

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



[issue4887] environment inspection and manipulation API is buggy, inconsistent with Python philosophy for wrapping native APIs

2014-11-26 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Agreed. environ.pop() was fixed a long time ago with issue1287.
It seems that all mutable methods of the environ pseudo-dict are now correctly 
reflected to the platform environ.

The other direction (updates from C code should be reflected in os.environ) is 
tracked by issue1159.

--
nosy: +amaury.forgeotdarc
resolution:  - duplicate
status: open - closed
superseder:  - os.getenv() not updated after external module uses C putenv()

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



[issue19676] Add the namereplace error handler

2014-11-25 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

The patch looks good to me.
But it seems that the reverse operation is not possible in the general case: 
.decode('unicode_escape') assumes a latin-1 or ascii encoding.
Should we document this?

--
nosy: +amaury.forgeotdarc

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



[issue1962] ctypes feature request: Automatic type conversion of input arguments to C functions

2014-11-24 Thread Amaury Forgeot d'Arc

Changes by Amaury Forgeot d'Arc amaur...@gmail.com:


--
resolution:  - works for me
status: open - closed

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



[issue7255] Default word boundaries for Unicode data?

2014-11-24 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Closing this old issue: either use the 'regex' module, or wait for issue2636.

--
nosy: +amaury.forgeotdarc
resolution:  - works for me
status: open - closed

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



[issue22600] In Multiprocessing Queue() doesn't work with list : __.put(list) != __.get()

2014-11-13 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

solution.put(c) takes a *reference* to the list c.
And then the test() function continues running!

By the time the list is serialized and sent back to the main process (in 
another thread), the test() function has already changed it...

As you noticed, you can use immutable objects instead (string, int), or make a 
copy of the list: solution.put(c.copy())

--
nosy: +amaury.forgeotdarc
resolution:  - not a bug
stage:  - resolved
status: open - closed

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



[issue22804] Can't run Idle in Windows 8 or windows 64

2014-11-06 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

You can try to run IDLE from a command prompt. Type the command:
  path_to_python34.exe -m idlelib

and look at error messages.

--
nosy: +amaury.forgeotdarc

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



[issue22790] __qualname__ missing from dir(__class__) during class initialisation

2014-11-04 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Why did you specify during class initialization only? When I print 
dir(Foo.Bar) at top-level, there is no __qualname__.

Then, note that '__name__' is not listed either, so it's not about new 
attributes.

It was chosen that dir(someClass) tries to list the know attributes of 
instances, not the attributes of the class object itself (__bases__, __mro__, 
and so on).
See https://docs.python.org/3.4/library/functions.html#dir

--
nosy: +amaury.forgeotdarc
resolution:  - works for me
status: open - pending

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



[issue22790] some class attributes missing from dir(Class)

2014-11-04 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

So, dir(C) contains '__mro__', but not 'mro'?

I'm -1 on the change.
From https://docs.python.org/3.4/library/functions.html#dir :

Note Because dir() is supplied primarily as a convenience for use at an 
interactive prompt, it tries to supply an interesting set of names more than it 
tries to supply a rigorously or consistently defined set of names, and its 
detailed behavior may change across releases. For example, metaclass attributes 
are not in the result list when the argument is a class.


dir(sys) does not list its __str__ method, even if sys.__str__() works, because 
returning only the explicit content of the module is more interesting to the 
user.

Likewise, the implementation of dir(__class__) returns the methods and 
attributes of *instances* because [someone decided that] it's the most relevant 
info for the user.

--

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



[issue22682] Add support of KZ1048 (RK1048) encoding

2014-10-30 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Looks good to me.
I checked that there are only 16 differences between cp1251 and kz1048,
and that the two standards define the same mapping.

--
nosy: +amaury.forgeotdarc

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



[issue22746] cgitb html: wrong encoding for utf-8

2014-10-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

What about
  open(..., encoding='latin-1', errors='xmlcharrefreplace')

--
nosy: +amaury.forgeotdarc
stage: resolved - needs patch

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



[issue22746] cgitb html: wrong encoding for utf-8

2014-10-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

 You need to use codecs.open instead of open
No, why? in python3 open() supports the errors handler.

--

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



[issue22721] pprint output for sets and dicts is not stable

2014-10-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

What if [some flavor of] pprint sorted items not by value, but by their repr() 
string?
It's probably faster than any other algorithm, and guaranteed to produce 
consistent results.

Or use this idea only for ambiguous cases?

--
nosy: +amaury.forgeotdarc

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



[issue22745] cgitb with Py3: TypeError: 'str' does not support the buffer interface

2014-10-27 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

html is text, so the file mode should be 'w'. 
But I don't reproduce the behavior with Python version v3.4.2.
Which version are you using exactly?

--
nosy: +amaury.forgeotdarc

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



[issue20485] Enable 'import Non-ASCII.pyd'

2014-02-02 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

I'd use a much simpler encoding.
Maybe something like
name.encode('unicode-escape').replace(b'\\', b'_')
As you said, simplicity is important for tools which generate code!

--
nosy: +amaury.forgeotdarc

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



[issue19973] Deprecate pyio

2013-12-13 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

PyPy also has a C-translated version of the io module.
It's a bit faster I think, but more importantly it has correct behavior with 
signals and other asynchronous errors.

_pyio.py can be stopped in the middle of any function, and is not completely 
signal-safe.

--
nosy: +amaury.forgeotdarc

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



[issue19423] permutations len issue

2013-10-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

permutations() returns a generator.
If you consume it with list(), the second time will return the empty list.

Use list(permutations(...)) if you plan to use the result multiple times.

--
nosy: +amaury.forgeotdarc
resolution:  - invalid
status: open - closed

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



[issue1540] Refleak tests: test_doctest and test_gc are failing

2013-10-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Is the error still current? io.StringIO is now completely implemented in 
_io/textio.c, and should not have any Python-level __del__.

--

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



[issue19272] Can't pickle lambda (while named functions are ok)

2013-10-16 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Functions are pickled by name, not by code.
Unpickling will only work if a function with the same name is present in in the 
same module (__main__ in your example)

This is why pickling a lambda won't work: they have no individual names.

--
nosy: +amaury.forgeotdarc

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



[issue19089] Windows: Broken Ctrl-D shortcut on Python 3

2013-09-25 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

It never worked for me.
Are you using a custom shell or cygwin or something?

--
nosy: +amaury.forgeotdarc

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



[issue19088] TypeError with pickle in embedded python3.3 when starting multiple Interpreters.

2013-09-25 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

The NoneType that fails is in typeobject.c:
   _PyObject_CallMethodId(copyreg, PyId__slotnames, O, cls);

The error here is that copyreg comes from a cached reference to the module, 
stored in a static variable (cached_copyreg_module).  When the interpreter 
shuts down the first time, all the module members are set to None... but the 
reference is kept forever.

This variable should be reset, and reloaded (with a fresh module from the new 
interpreter) the next time it's used.
I added a call to _PyType_Fini() in Py_EndInterpreter, this fixes the given 
example.

Two sets of questions though:

- There are many of these _Fini functions, called in Py_Finalize. Which ones 
should we call in Py_EndInterpreter? and why? Maybe this PyType_Fini() is not a 
_Fini, but should be renamed PyType_EndInterpreter?

- one copyreg for multiple interpreters... this looks wrong: each interpreter 
has its own list of modules, but copyreg.__globals__ belongs to only one...
  A good solution would be to cache the copyreg module in the 
PyInterpreterState (it already has codec_search_cache). Or use 
PyImport_GetModuleDict()

--
nosy: +amaury.forgeotdarc

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



[issue19048] itertools.tee doesn't have a __sizeof__ method

2013-09-19 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

I like the definition of __sizeof__ that was discussed some time ago:
http://bugs.python.org/issue14520#msg157798

With that definition (do we have it somewhere in the docs, by the way?)
The current code works gives the correct answer.

--
nosy: +amaury.forgeotdarc

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



[issue19048] itertools.tee doesn't have a __sizeof__ method

2013-09-19 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

getsizeof() is interesting only if it gives sensible results when used 
correctly, especially if you want to sum these values and get a global memory 
usage.

One usage is to traverse objects through gc.get_referents(); in this case the 
definition above is correct.

Now, are you suggesting to traverse objects differently? With dir(), or 
__dict__?

(btw, this discussion explains why pypy still does not implement getsizeof())

--

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



[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-12 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

 2. _PyVerify_fd(fd) is always true. Given the current definition:
 #define _PyVerify_fd(fd) (_get_osfhandle(fd) = 0)
 for those values of fd _get_osfhandle(fd) = 0, always.

Hum, are you sure this is the selected implementation?
- this code is only in 2.7
  http://hg.python.org/cpython/file/v2.7/Include/fileobject.h#l73
- it's protected by #if statements. In your case the first case should be 
selected, can you verify if it's the case, and if not, why?

--

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



[issue18913] ssl._ssl._test_decode_cert seems to leak memory with certain certificates in Python 2.6

2013-09-03 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

To ensure it's a real memory leak: do the figures increase when the code is 
called in a loop?
I would not consider a single-time malloc (stored in some static variable) to 
be a leak.

--
nosy: +amaury.forgeotdarc

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



[issue18913] ssl._ssl._test_decode_cert seems to leak memory with certain certificates in Python 2.6

2013-09-03 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

http://hg.python.org/cpython/rev/c4bbda2d4c49 looks relevant.

--

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



[issue18913] ssl._ssl._test_decode_cert seems to leak memory with certain certificates in Python 2.6

2013-09-03 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Ah, http://hg.python.org/cpython/rev/80d491aaeed2/ as well then.

--

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



[issue14597] Cannot unload dll in ctypes until script exits

2013-08-29 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Did you consider creating a copy with a random suffix?

--
nosy: +amaury.forgeotdarc

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



[issue18874] Add a new tracemalloc module to trace memory allocations

2013-08-29 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Is it really impossible to use a standard Python dict instead of cfuhash?

--
nosy: +amaury.forgeotdarc

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



[issue18843] Py_FatalError (msg=0x7f0e3b373232 bad leading pad byte) at Python-2.7.5/Python/pythonrun.c:1689

2013-08-26 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

This is a memory corruption.
Please look at the memory before the freed address (0x449e6900), maybe there is 
an indication of some buffer overflow?

--
nosy: +amaury.forgeotdarc

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



[issue16396] Importing ctypes.wintypes on Linux gives a traceback

2013-08-19 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

I think it's the opposite: when Unix support was added to ctypes, 'import 
ctypes.wintypes' was not considered. By that logic, the patch is a new feature.
IMO historical arguments are moot :-)

I agree with the conclusion tough: the patch will not break code that carefully 
catches ValueError, and so it suitable for 2.7.

--

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



[issue18535] termios.tcgetattr should return namedtuple

2013-07-24 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

You need a better use case though.
termios awful constant names ('TIOCGWINSZ') and values ('\x1b') won't become 
more easy with a nametuple.

--
resolution:  - works for me
status: open - closed

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



[issue18535] termios.tcgetattr should return namedtuple

2013-07-23 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

namedtuple has a _replace method, but I agree that it would be an incompatible 
change. namedlist someone?

class tcattributes(object):
__slots__ = ['iflag', 'oflag', 'cflag', 'lflag', 'ispeed', 'ospeed', 'cc']

def __new__(cls, values):
self = object.__new__(cls)
for attr, value in zip(cls.__slots__, values):
setattr(self, attr, value)
return self

def __getitem__(self, index):
return getattr(self, self.__slots__[index])

--
nosy: +amaury.forgeotdarc

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



[issue18488] sqlite: finalize() method of user function may be called with an exception set if a call to step() method failed

2013-07-19 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

+1 for PyException_SetContext or similar. The C code should behave like a 
finally: x.finalize().

--
nosy: +amaury.forgeotdarc

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



[issue18474] Lambda assigned to object does not automatically get self

2013-07-16 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

This is expected. When you assign to n.__div__ a function which takes two 
parameters, you have to call it with two parameters:

aFunction = lambda x, y: (x, y)
n.__div__ = aFunction
aFunction(1, 2)
n.__div__(1, 2)

After all, aFunction and n.__div__ are the same object.
Now, it would be different if you had attached the function to the *class* 
instead:

n.__class__.__div__ = aFunction
n.__div__(2)   # returns (n, 2)

In this second example, n.__div__ is a bound method; the first parameter 
(usually named self) is already filled, and only the second one is required.

--
nosy: +amaury.forgeotdarc
resolution:  - invalid
status: open - closed

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



[issue18426] Crash when extension does not use PyModule_Create()

2013-07-11 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

I'm not sure the fix is correct: PyModule_GetDef() can return NULL without 
setting an error, for example when the init function returns a regular Python 
module.

I'm OK to require the init function to return a module created with 
PyModule_Create(), and fail when it's not the case. But an exception should be 
set.
(and a unit test would help...)

--
nosy: +amaury.forgeotdarc

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



[issue18426] Crash when extension does not use PyModule_Create()

2013-07-11 Thread Amaury Forgeot d'Arc

Changes by Amaury Forgeot d'Arc amaur...@gmail.com:


--
status: closed - open

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



[issue18426] Crash when extension does not use PyModule_Create()

2013-07-11 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

I was thinking of a message similar to the one above.
The eventual exception set by PyModule_GetDef(m) is less explicit.

if (def == NULL) {
PyErr_Format(PyExc_SystemError,
initialization of %s did not return an extension module,
shortname);
goto error;
}

--

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



[issue18426] Crash when extension does not use PyModule_Create()

2013-07-11 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Returning another kind of module can be dangerous here, because extension 
modules are handled specially (see _PyImport_FixupExtensionObject),
and it's not obvious what this does to normal modules.

But I agree that _imp.load_dynamic() could be extended to plain modules.
A bit like class/type unification.

--

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



[issue18359] pickle fail to handle some class with __new__

2013-07-04 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

This is expected, your class must say how this __new__ constructor can be 
called.
http://docs.python.org/2/library/pickle.html#object.__getnewargs__

--
nosy: +amaury.forgeotdarc
resolution:  - works for me
status: open - closed

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



[issue18350] Python 3 unittest framework broken?

2013-07-03 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

wxPython tests override unittest.TextTestRunner:
self.stream = unittest.runner._WritelnDecorator(BytesIO())

Using bytes is wrong. Output stream should be a text file.

--
nosy: +amaury.forgeotdarc
resolution:  - invalid
status: open - closed

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



[issue18350] Python 3 unittest framework broken?

2013-07-03 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

This is an issue with wxPython, please report this issue to the wxPython team.

--

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



[issue18350] Python 3 unittest framework broken?

2013-07-03 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Sorry, this bug tracker is for core Python only. Please discuss this issue on 
wxPython-dev mailing list.

--

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



[issue18327] swapped arguments in compatible_for_assignment()?

2013-07-01 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Fortunately, compatible_for_assignment() handles both arguments exactly the 
same way, except maybe in error messages.

--
nosy: +amaury.forgeotdarc

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



[issue18287] PyType_Ready() should sanity-check the tp_name field

2013-06-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

The patch is not complete: PyType_Ready() returns -1 but no no exception is set.

--

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



[issue18287] PyType_Ready() should sanity-check the tp_name field

2013-06-28 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Since this error can occur only during the development of a C extension, I 
would not worry too much. The traceback will already indicate the imported 
module, this is much better than a segfault later in pydoc.

--

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



[issue18298] pythonw.exe fails with redirected stderr

2013-06-26 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

RPython... let's be serious. The code of pythonw.exe is very simple, see 
PC/WinMain.c.

No, pythonw.exe is not meant to suppresses the terminal window on startup. 
This is only a consequence of being a windows application. There is a lot of 
documentation about this, for example:
http://comsci.liu.edu/~murali/win32gui/Win32Apps.htm

- python.exe is a regular console application, with a main() function.
- pythonw.exe is a gui application, with a WinMain() function; as a 
consequence, stdout/stderr won't work properly.

Again, it's a won't fix for 2.7, unless someone comes with a patch. But this 
has already been tried, and be careful, different versions of the msvcrt differ 
in behavior here.

--
resolution:  - wont fix
status: open - closed

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



[issue18298] pythonw.exe fails with redirected stderr

2013-06-25 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Yes, in pythonw.exe the C stderr is not really usable, and this leads to 
unpredictable results.
It's difficult to fix in python2 though; python3 has fixed this issue, but in a 
way that cannot be backported.

Some workarounds:
- don't use pythonw.exe in a console, it's meant to be a *windows* application, 
without standard streams. I'm actually surprised of the behavior of your first 
example.

- use python3, where pythonw will set sys.stderr to None, and prints will be 
silently discarded.

--
nosy: +amaury.forgeotdarc
resolution:  - wont fix
status: open - closed

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



[issue18298] pythonw.exe fails with redirected stderr

2013-06-25 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

The proper solution if you use pythonw.exe is to define sys.stdout/sys.stderr 
yourself in pythonw.exe::
sys.stdout = open('c:/temp/output.txt', 'w')

IOW, do the redirect from inside the program, don't rely on the shell which (by 
design?) does not work correctly with /subsytem:windows binaries.
Again, this is a workaround for 2.7, because no backward-compatible fix could 
be found.

--
resolution:  - wont fix
status: open - closed

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



[issue17630] Create a pure Python zipfile importer

2013-06-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Times in a ZIP files have a two-seconds resolution (in the old DOS FAT format: 
5 bits for the hours, 6 bits for the minutes, and only 5 bits left for the 
seconds)
Some fuziness logic is needed when comparing against a time_t.

--
nosy: +amaury.forgeotdarc

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



[issue18276] posixpath.c:_fd_converter() should use PyObject_AsFileDescriptor()

2013-06-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Do we want the low-level os.write() to work with file objects, or sockets?

--
nosy: +amaury.forgeotdarc

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



[issue18276] posixpath.c:_fd_converter() should use PyObject_AsFileDescriptor()

2013-06-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

 Let's unify os' and select's behavior!
OK, let's do that on Windows first :-)

--

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



[issue18270] AttributeError: 'NoneType' object has no attribute 'interp'

2013-06-20 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

PyShell.py, line 1541:
if shell and cmd or script:
Does it need parentheses?
if shell and (cmd or script):

--
nosy: +amaury.forgeotdarc

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



[issue1159] os.getenv() not updated after external module uses C putenv()

2013-06-19 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

FYI, PyPy recently got bitten by this: https://bugs.pypy.org/issue1518
A posix.libc_getenv() function could be a solution.

--
nosy: +amaury.forgeotdarc

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



[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-06-19 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

in encoder.py:
...
elif instance(value, int):
yield buf + str(value)
...
What if we use int(str(value)) instead?

--
nosy: +amaury.forgeotdarc

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



[issue18248] fficonfig.py.in wrong for AIX

2013-06-18 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

LGTM. I checked in Makefile.am, and the list of platform-specific files is the 
same.

--

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



[issue18225] ctypes Structure data size is incorrect

2013-06-17 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

You can also use _pack_ = 1 to override the default alignment rules:
http://docs.python.org/3/library/ctypes.html#ctypes.Structure._pack_

--
nosy: +amaury.forgeotdarc

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



[issue18208] Wrong bytecode generated for 'in' operation

2013-06-14 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

This is one case of chained comparisons:
http://docs.python.org/3/reference/expressions.html#not-in

x = y = z is equivalent to (x = y) and (y = z)
x in y == z is equivalent to (x in y) and (y == z)

There is a jump if the 'in' expression is false, because 'and' should 
short-circuit the second comparison.

--
nosy: +amaury.forgeotdarc
resolution:  - invalid
status: open - pending

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



[issue18210] Problem creating extension in python3.3 with mingw32

2013-06-14 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Python3 has a new API to create modules: PyModule_Create() and PyModuleDef.

See also:
http://docs.python.org/3/howto/cporting.html?highlight=pymodule_create#module-initialization-and-state

--
nosy: +amaury.forgeotdarc
resolution:  - invalid
status: open - closed

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



[issue15315] Can't build Python extension with mingw32 on Windows

2013-06-14 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Aditya, python3 changed the API to create modules. See issue18210.

--
nosy: +amaury.forgeotdarc

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



[issue17860] subprocess docs lack info how to use output result

2013-06-13 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Surely there are already good places to help with 2-3 transition?
The Library Reference is not such a place.

--
nosy: +amaury.forgeotdarc

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



[issue515074] Extended storage in new-style classes

2013-06-12 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Most concrete variable-sized types don't use tp_basicsize to know where the 
data lives. For example, PyBytesObject has a char ob_sval[1]; member, and 
PyBytes_AsString() looks at this fixed offset.
For this reason, additional data cannot be stored before the variable-length 
section, only after.

It is possible to store data after the variable section, and CPython does it 
already for the __dict__ slot of user-defined classes::
 bytes.__basicsize__
33
 class B(bytes): pass
...
 B.__basicsize__
41
 B.__dictoffset__
-8

Note that tp_basicsize was increased by the size of the additional data (here a 
PyObject*).
To access your data, the logic is something like::
tp-tp_basicsize + (obj-ob_size * tp-tp_itemsize) - sizeof(MyData)
The function _PyObject_GetDictPtr() has similar code, and already aligns to the 
pointer size.

Of course, at the end of one object you cannot have *both* a __dict__ slot and 
custom data.
The custom type needs to either disallow subclassing, or provide a (negative) 
tp_dictoffset.
Also, some care may be required if the base class uses a custom allocator.

Overall, I think it's a bit involved, but doable.
I close the issue as works for me, someone can reopen if there is something 
wrong in the base types.

--
nosy: +amaury.forgeotdarc
resolution:  - works for me
status: open - closed

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



[issue3329] API for setting the memory allocator used by Python

2013-06-11 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

I prefer the new version without PYMEM_TRACE_MALLOC :-)

Can we rename API and api_id to something more specific? maybe DOMAIN and 
domain_id?

--

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



[issue18181] super vs. someclass.__getattribute__

2013-06-11 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Is it possible to avoid a new slot?
for example, super() could walk the tp_base- chain and call tp_getattro each 
time the value changes.

--

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



[issue18178] Redefinition of malloc(3) family of functions at build time

2013-06-10 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Said simpler: dlmalloc.c code is indeed compiled twice:
- once as part of closures.c, which #include dlmalloc.c; this is done 
carefully (with 'static' and 'USE_DL_PREFIX') to not clash with standard malloc 
functions.
- once as a separate target; without USE_DL_PREFIX it will define functions 
named malloc() and free()...

The second one is not necessary, of course. The patch looks good to me.

--

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



[issue18181] super vs. someclass.__getattribute__

2013-06-10 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Do you have an example in pure Python code?

--
nosy: +amaury.forgeotdarc

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



[issue18183] Calling .lower() on certain unicode string raises SystemError

2013-06-10 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

 a = chr(0x84b2e)+chr(0x109710)
 a.lower()
SystemError: invalid maximum character passed to PyUnicode_New

The MAX_MAXCHAR() macro only works for 'maxchar' values, like 0xff, 0x...  
in do_upper_or_lower() it's used with arbitrary UCS4 values.

--
nosy: +amaury.forgeotdarc, haypo

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



[issue18181] super vs. someclass.__getattribute__

2013-06-10 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

issue783528 was a bit similar.

--

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



[issue17206] Py_XDECREF() expands its argument multiple times

2013-06-04 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Hum, a stack overflow?

--

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



  1   2   3   4   5   6   7   8   9   10   >