[issue23203] Aliasing import of sub-{module, package} from the package raises AttributeError on import.

2015-01-08 Thread Franck Michea

New submission from Franck Michea:

Hi, for those of you that prefer to read an example, you can read that 
commented demonstration of the bug[1].

Today I discovered what I think is a bug in the import system. Here is the 
basic setup:

We have three nested packages: foo - bar - baz. The bar package imports 
foo.bar.baz. We try to import foo.bar. This works well unless we try to alias 
the foo.bar.baz import in foo.bar with the import ... as ... syntax. In that 
case the file will be read and executed but when we get out of the import 
statement, then python throws:

Traceback (most recent call last):
  File string, line 1, in module
  File foo_alias_mod/bar/__init__.py, line 1, in module
import foo_alias_mod.bar.baz as name_does_not_matter
AttributeError: 'module' object has no attribute 'bar'

This works whether baz is a package or a module actually. It does not matter if 
it's from the interpreter, or in a file, ... I've seen it trigger with 2.7.5, 
2.7.9, 3.4.5, tip, so I guess this has been here for some time.

Please read the link below for a complete demo, and you can always download the 
tarball[2] to test yourself.

[1]: Commented demonstration: http://98810f8c06.net/wtf_python.html
[2]: Tarball for test: http://98810f8c06.net/wtf_python-demo.tar.bz2

--
components: Interpreter Core
messages: 233719
nosy: franck
priority: normal
severity: normal
status: open
title: Aliasing import of sub-{module,package} from the package raises 
AttributeError on import.

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



[issue20604] Missing invalid mode in error message of socket.makefile.

2014-02-11 Thread Franck Michea

New submission from Franck Michea:

Hi! Noticed that the wrong mode was missing from the error message of 
socket.makefile. Nothing important, but this patch fixes the thing anyway, if 
you want it.

--
components: Library (Lib)
files: missing_mode_in_error.patch
keywords: patch
messages: 211026
nosy: kushou
priority: normal
severity: normal
status: open
title: Missing invalid mode in error message of socket.makefile.
type: enhancement
versions: Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file34049/missing_mode_in_error.patch

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



[issue17239] XML vulnerabilities in Python

2013-02-19 Thread Franck Michea

Changes by Franck Michea franck.mic...@gmail.com:


--
nosy: +kushou

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



[issue12077] Harmonizing descriptor protocol documentation

2013-02-11 Thread Franck Michea

Franck Michea added the comment:

Here is at least a correction of Descriptors' HowTo. There are two versions 
since some stuff differs (object inheritance, ...).

Here are some of my interrogations though:
 - RevealAccess is not using instance parameter, so value is shared. Is this 
intended?
 - Don't really know what to do with Function and Methods part. First I don't 
really understand the relevance of this in a descriptor how-to. Also it is know 
outdated in python3 version (unbound thing, ...), so what do?
 - In __getattribute__ function, I don't really understand the paramters given 
to __get__, why None and the instance? But this is probably my fault.

This also doesn't answer the question about the real source that should be 
kept. What to do?

I also need a proof-read, since english is not my first language... Anyway it's 
clearly not enough to be published like that

Have a nice day!

--
keywords: +patch
nosy: +kushou
versions: +Python 3.5
Added file: 
http://bugs.python.org/file29040/12077_descriptor_howto_python3.patch

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



[issue12077] Harmonizing descriptor protocol documentation

2013-02-11 Thread Franck Michea

Changes by Franck Michea franck.mic...@gmail.com:


Added file: 
http://bugs.python.org/file29041/12077_descriptor_howto_python2.patch

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



[issue17157] issubclass() should accept iterables in 2nd arg

2013-02-09 Thread Franck Michea

Franck Michea added the comment:

I am neutral on this too, it just felt odd and this is why the question raised.

Yesterday I tried to add sequences and iterables (only to issubclass but indeed 
it would need better testing and all) and came to a problem with sequences. The 
current implementation authorizes (A, (B, (C, D))) (why?) so issubclass is 
recursive, but if we add sequences, they could create infinite recursions if 
seq[0] == seq (it's the case for strings for example, where 'a' is still a 
sequence and 'a'[0] == 'a').

So I don't know if it's really interesting. Anyone can use tuple() on an 
iterable to build its tuple value, though the value is built in memory. It 
basically just felt odd to take only tuples but I don't know.

--

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



[issue17151] Python 3 changement of behavior with __ne__: documentation not updated

2013-02-07 Thread Franck Michea

New submission from Franck Michea:

Hi. As of python 3, behavior of object.__ne__ changed to call (not 
object.__eq__) if implemented. This changement can be seen in function 
object_richcompare in file Objects/typeobject.c.

Documentation didn't change though, still saying[1] that There are no implied 
relationships among the comparison operators. [...] Accordingly, when defining 
__eq__(), one should also define __ne__().

Maybe a paragraph about this new behavior would be fine? I am not sure if last 
sentence of last paragraph is what it means, but it was already there in python 
2 doc so guess no. I am not sure about how to write it so no patch, sorry.

[1] http://docs.python.org/3.3/reference/datamodel.html#object.__eq__

--
assignee: docs@python
components: Documentation
messages: 181620
nosy: docs@python, kushou
priority: normal
severity: normal
status: open
title: Python 3 changement of behavior with __ne__: documentation not updated
versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

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



[issue16143] Building with configure option --without-doc-strings crashes first time through PyUnicode_DecodeUTF8Stateful

2013-01-05 Thread Franck Michea

Changes by Franck Michea franck.mic...@gmail.com:


--
nosy: +kushou

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



[issue16849] Element.{get, iter} doesn't handle keyword arguments when using _elementtree C accelerator.

2013-01-03 Thread Franck Michea

New submission from Franck Michea:

Documentation:
 - 
http://docs.python.org/3.3/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.get
 - 
http://docs.python.org/3.3/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.iter

These two functions are documented with keyword arguments. Python 
implementation works correctly, but as of 3.3, _etreeelement module in C is 
hot-patching this module to enhance speed. C implementation only expects normal 
arguments for get and iter. This is what this patch fixes.

First patch so:
 - I am not sure about the key string in kwlist array, I followed code above 
and it doesn't work without it, so I guess it's to for the normal arg.
 - I am not sure about how to test iter with this. tag argument is never used.
 - Included a test that shows the problem.

Have a nice day,

--
components: Library (Lib), XML
files: etree.patch
keywords: patch
messages: 178939
nosy: kushou
priority: normal
severity: normal
status: open
title: Element.{get,iter} doesn't handle keyword arguments when using 
_elementtree C accelerator.
type: behavior
versions: Python 3.3
Added file: http://bugs.python.org/file28541/etree.patch

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