[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread STINNER Victor
STINNER Victor added the comment: I marked bpo-20519 as a duplicate of this issue, even if it's not exactly the same. The main purpose of this issue was to use uuid_generate_time() using a C extension: +static PyObject * +_uuid_generate_random(void) +{ +uuid_t out; +uuid_generate_rand

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread STINNER Victor
STINNER Victor added the comment: I marked bpo-5885 as a duplicate of this issue, even if it's not exactly the same. The main purpose of this issue was to use uuid_generate_time() using a C extension, as bpo-20519. +static PyObject * +uuid_uuid1(PyObject *self, PyObject *args) +{ +uui

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: PR 3684 seems mostly a subset of what I'm proposing. -- ___ Python tracker ___ ___ Python-bugs-lis

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread STINNER Victor
STINNER Victor added the comment: Oh. I was told that the PR 3684 of bpo-5885 in another fix for this issue. -- ___ Python tracker ___ _

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I would prefer to reorganize uuid.py in a second step I am not reorganizing uuid.py, just making initialization lazy. -- ___ Python tracker ___

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread INADA Naoki
INADA Naoki added the comment: >> Sorry, I reject my idea. It clearly overdone. uuid.py is not so huge. > Can you please elaborate? Do you think that my PR is wrong? I looked https://github.com/python/cpython/pull/3684 and I wonder if I should recommend to split module before review. So I mea

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread STINNER Victor
STINNER Victor added the comment: It's nice to see things moving in this 6 years old issue :-) -- ___ Python tracker ___ ___ Python-

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread STINNER Victor
STINNER Victor added the comment: Antoine: "I think https://github.com/python/cpython/pull/3796 is a better resolution. It creates an optional _uuid C extension to avoid ctypes if possible *and* also loads system functions lazily." Implementing bpo-20519 is a very good idea. But I still like

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: And on Windows, _windll_getnode() calls into _UuidCreate(). -- ___ Python tracker ___ ___ Python-b

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Do you know a native APIs for Windows and Linux? On Linux, we already use uuid_generate_time(). See _unixdll_get_node(). -- ___ Python tracker ___

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread STINNER Victor
STINNER Victor added the comment: > I think launching external tools like ifconfig and ipconfig can be avoided > pretty easily. There are many recipes around the net how to use native API's. That's right, but I would prefer to enhance uuid to use native API's in a different issue and focus on

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: I think https://github.com/python/cpython/pull/3796 is a better resolution. It creates an optional _uuid C extension to avoid ctypes if possible *and* also loads system functions lazily. -- versions: -Python 3.8

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread STINNER Victor
STINNER Victor added the comment: uuid code contains 4 bare "except:" blocks which should be replaced with appropriate exceptions, or at least "except Exception:" to not catch KeyboardInterrupt. But this should be modified in a second time. -- ___

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread Antoine Pitrou
Change by Antoine Pitrou : -- pull_requests: +3780 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread STINNER Victor
STINNER Victor added the comment: > It ease splitting out (heavy and slow and dirty) part into submodule without > breaking backward compatibility. Right. I created attached PR #3795 to implement this idea. > I hope PEP 562 is accepted. I don't think that this PEP is needed here. IMHO a new

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +3779 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread Christian Heimes
Change by Christian Heimes : -- versions: +Python 3.7, Python 3.8 -Python 3.5 ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread INADA Naoki
INADA Naoki added the comment: Sorry, I reject my idea. It clearly overdone. uuid.py is not so huge. -- versions: +Python 3.5 -Python 3.7 ___ Python tracker ___ __

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread Antoine Pitrou
Change by Antoine Pitrou : -- versions: +Python 3.7 -Python 3.5 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue11063] uuid.py module import has heavy side effects

2017-09-28 Thread INADA Naoki
INADA Naoki added the comment: How often uuid1 is used? I never use it and it looks uuid1 makes uuid.py complicated. How about split it to _uuid1.py (or uuid/__init__.py and uuid/_uuid1.py)? I hope PEP 562 is accepted. It ease splitting out (heavy and slow and dirty) part into submodule withou

[issue11063] uuid.py module import has heavy side effects

2016-05-12 Thread aixtools
aixtools added the comment: The way I have seen that resolved - in many locations, is to have the option to specify a specific version, e.g., libFOO.so.1 and then as long as that version remains available, perhaps as read-only for running with existing programs,they continue to work even when

[issue11063] uuid.py module import has heavy side effects

2016-05-08 Thread Martin Panter
Martin Panter added the comment: There is already Issue 20519 for that, although it looks like the proposed patch keeps ctypes as a fall-back. (My interest here is only theoretical.) -- ___ Python tracker

[issue11063] uuid.py module import has heavy side effects

2016-05-08 Thread Christian Heimes
Christian Heimes added the comment: It sounds like ctypes is causing you some headache. How about we get rid of ctypes for uuid and replace it with a simple implementation in C instead? Autoconf (configure) can take care of the library detection easily. --

[issue11063] uuid.py module import has heavy side effects

2016-05-07 Thread Martin Panter
Martin Panter added the comment: The versioning problem with libFOO.so.N already occurs with compiled programs. A C program compiled against libuuid.so.1 will fail to load if you only have libuuid.so.2. On the other hand, a Python program using find_library() will find either version. My point

[issue11063] uuid.py module import has heavy side effects

2016-05-06 Thread Michael Felt
Michael Felt added the comment: I cannot comment on uuid directly, but for me, this is yet another example of how assumptions can break things. imho - if you know the exact version of s shared library that you want, calling cdll directly should be find. Maybe find_library is historic. However

[issue11063] uuid.py module import has heavy side effects

2016-04-24 Thread Martin Panter
Martin Panter added the comment: One thing I am wondering about is why we have to use find_library() at all. Wouldn’t it be more robust, and more efficient, to call CDLL() directly? We just have to know the exactly library version we are expecting. On Linux, the full soname is libuuid.so.1. It

[issue11063] uuid.py module import has heavy side effects

2014-10-04 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +serhiy.storchaka stage: needs patch -> patch review versions: +Python 3.5 -Python 3.4 ___ Python tracker ___ ___

[issue11063] uuid.py module import has heavy side effects

2013-02-24 Thread Jyrki Pulliainen
Jyrki Pulliainen added the comment: Here's a second take on the patch -- Added file: http://bugs.python.org/file29220/issue11063_2.patch ___ Python tracker ___ __

[issue11063] uuid.py module import has heavy side effects

2013-02-24 Thread Jyrki Pulliainen
Changes by Jyrki Pulliainen : Removed file: http://bugs.python.org/file29189/issue11063_2.patch ___ Python tracker ___ ___ Python-bugs-list ma

[issue11063] uuid.py module import has heavy side effects

2013-02-24 Thread Hynek Schlawack
Hynek Schlawack added the comment: Jyrki, roundup doesn’t seem to recognize you patch so we can’t review it in Rietveld. Could you re-try, maybe using hg? -- ___ Python tracker

[issue11063] uuid.py module import has heavy side effects

2013-02-23 Thread Jyrki Pulliainen
Jyrki Pulliainen added the comment: The implementation does not actually end up in infinite loop, just repeating the loading of the CDLL is slow. I added caching to that and fixed the ctypes imports too. -- nosy: +nailor Added file: http://bugs.python.org/file29189/issue11063_2.patch

[issue11063] uuid.py module import has heavy side effects

2012-12-27 Thread Christian Heimes
Christian Heimes added the comment: Hynek, you are right. -- nosy: +christian.heimes ___ Python tracker ___ ___ Python-bugs-list maili

[issue11063] uuid.py module import has heavy side effects

2012-12-27 Thread Hynek Schlawack
Hynek Schlawack added the comment: The patch hasn’t incorporated Antoine’s comments AFAICT. Also I don’t see this fit for back porting to bug fix releases. Correct me if I’m wrong. -- nosy: +hynek stage: patch review -> needs patch versions: +Python 3.4 -Python 2.7, Python 3.2, Python

[issue11063] uuid.py module import has heavy side effects

2011-02-05 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I'm thinking Python could use a general purpose ifconfig/mac-layer > module that uuid.py could then just use. Perhaps, but that's really out of scope for this issue. Feel free to open another issue. -- ___ Python

[issue11063] uuid.py module import has heavy side effects

2011-02-05 Thread Keith Dart
Keith Dart added the comment: I'm thinking Python could use a general purpose ifconfig/mac-layer module that uuid.py could then just use. -- ___ Python tracker ___

[issue11063] uuid.py module import has heavy side effects

2011-02-05 Thread Kenny Meyer
Changes by Kenny Meyer : Removed file: http://bugs.python.org/file20687/unnamed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsub

[issue11063] uuid.py module import has heavy side effects

2011-02-05 Thread Vetoshkin Nikita
Vetoshkin Nikita added the comment: >It's also possible using existing wrapped os system calls. That's right, on linux we can use ioctls but windows would require win api calls like this one: http://stackoverflow.com/questions/166506/finding-local-ip-addresses-in-python/166992#166992

[issue11063] uuid.py module import has heavy side effects

2011-02-05 Thread Keith Dart
Keith Dart added the comment: It's also possible using existing wrapped os system calls. One exaple is here: http://code.google.com/p/pycopia/source/browse/trunk/aid/pycopia/ifconfig.py Although that one doesn't current support MAC addresses, but it could. The socket module also now support t

[issue11063] uuid.py module import has heavy side effects

2011-02-05 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Maybe I understood and ctypes ImportError simply must be handled and > fallbacked to something else. Indeed. > But there are only 3 ways of getting MAC address: > 1. using popen > 2. using ctypes and native calls > 3. using C API and performing native calls

[issue11063] uuid.py module import has heavy side effects

2011-02-05 Thread Vetoshkin Nikita
Vetoshkin Nikita added the comment: Maybe I understood and ctypes ImportError simply must be handled and fallbacked to something else. But there are only 3 ways of getting MAC address: 1. using popen 2. using ctypes and native calls 3. using C API and performing native calls in extension And c

[issue11063] uuid.py module import has heavy side effects

2011-02-05 Thread Kenny Meyer
Kenny Meyer added the comment: Thanks for pointing that out! I guess that is the reason you did the import in a try block. -- Added file: http://bugs.python.org/file20687/unnamed ___ Python tracker ___

[issue11063] uuid.py module import has heavy side effects

2011-02-05 Thread Antoine Pitrou
Antoine Pitrou added the comment: > A bit of offtopic: why can't we assume that ctypes is available? Because ctypes (or, actually, the libffi it relies on) needs specific low-level code for each platform it runs on, and not all platforms have such code. Another reason is that ctypes is danger

[issue11063] uuid.py module import has heavy side effects

2011-02-05 Thread Vetoshkin Nikita
Vetoshkin Nikita added the comment: >uuid should work even when ctypes is not available A bit of offtopic: why can't we assume that ctypes is available? -- ___ Python tracker __

[issue11063] uuid.py module import has heavy side effects

2011-02-05 Thread Antoine Pitrou
Antoine Pitrou added the comment: Thanks for posting a patch! I have two comments: - Have you run test_uuid? When I run it, it seems to go into an infinite loop somewhere and I need to kill the process. - uuid should work even when ctypes is not available, so you can't just put an import state

[issue11063] uuid.py module import has heavy side effects

2011-02-05 Thread R. David Murray
R. David Murray added the comment: If you do 'python -c "import uuid" under strace, _posixsubprocess is definitely loaded, and a pipe2 call is made. Take a look at the code starting at (py3k trunk) line 418 (try:). That's where the weird stuff happens, which is what the patch is addressing.

[issue11063] uuid.py module import has heavy side effects

2011-02-05 Thread Senthil Kumaran
Senthil Kumaran added the comment: Kenny, I don't see a problem with uuid is *imported*, it just creates a couple of STANDARD UUID class objects for use later. And this seems to just set the number and validates it. I don't see any subprocess calls performed. Perhaps you were referring to sce

[issue11063] uuid.py module import has heavy side effects

2011-02-05 Thread Kenny Meyer
Kenny Meyer added the comment: With the attached patch the "heavy work" will be done on request, when calling uuid1() or uuid4() not on import. I am working off from the py3k svn branch. Is it necessary to submit a separate patch for py2 branch? -- keywords: +patch nosy: +knny-myer A

[issue11063] uuid.py module import has heavy side effects

2011-02-05 Thread Vetoshkin Nikita
Vetoshkin Nikita added the comment: I think launching external tools like ifconfig and ipconfig can be avoided pretty easily. There are many recipes around the net how to use native API's. About ctypes' horrible logic during find_library call - don't know yet. -- nosy: +nvetoshkin ___

[issue11063] uuid.py module import has heavy side effects

2011-02-04 Thread Éric Araujo
Changes by Éric Araujo : -- nosy: +eric.araujo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue11063] uuid.py module import has heavy side effects

2011-01-29 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- keywords: +easy stage: -> needs patch versions: +Python 3.2, Python 3.3 ___ Python tracker ___ ___ Pyt

[issue11063] uuid.py module import has heavy side effects

2011-01-29 Thread Keith Dart
Changes by Keith Dart : -- nosy: +kdart ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/

[issue11063] uuid.py module import has heavy side effects

2011-01-29 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis : -- nosy: +Arfrever ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue11063] uuid.py module import has heavy side effects

2011-01-29 Thread Keith Dart
New submission from Keith Dart : When the uuid.py module is simply imported it has the side effect of forking a subprocess (/sbin/ldconfig) and doing a lot of stuff find a uuid implementation by ctypes. This is undesirable in many contexts. It would be better to perform those tasks on demand,