[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_random(out);
+return PyBytes_FromStringAndSize((const char *) out, sizeof(out));
+}

+static PyObject *
+_uuid_generate_time(void)
+{
+uuid_t out;
+uuid_generate_time(out);
+return PyBytes_FromStringAndSize((const char *) out, sizeof(out));
+}

--

___
Python tracker 

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



[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)
+{
+uuid_t out;
+uuid_generate_time(out);
+return PyByteArray_FromStringAndSize((const char *) out,sizeof(out));
+}

+static PyObject *
+uuid_uuid4(PyObject *self, PyObject *args)
+{
+uuid_t out;
+uuid_generate_random(out);
+return PyByteArray_FromStringAndSize(out,sizeof(out));
+}

--

___
Python tracker 

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



[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-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 

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



[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 

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



[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 meant "I stop requesting split module and I'll review the PR3684."

Now I see your PR and it looks more clean.

--

___
Python tracker 

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



[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-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 the idea of 
putting all these ugly functions to get the node and geneate a UUID1 object in 
a different module, since most of these code is not used on most platforms.

Antoine: Would you mind to modify your PR 3796 to only implement bpo-20519? I 
would prefer to reorganize uuid.py in a second step. It will be easy to review 
and easy to discuss what is the best option.

--

___
Python tracker 

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



[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-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 

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



[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 avoiding "side effects" on "import uuid" in this 
issue.

Do you know a native APIs for Windows and Linux? I don't. Do you have links to 
these "recipes"? If yes, please open a new issue.

--

___
Python tracker 

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



[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

___
Python tracker 

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



[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.

--

___
Python tracker 

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



[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://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 _uuid1 module is enoguh 
to avoid "side effects" on "import uuid".

> 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?

--
nosy: +haypo

___
Python tracker 

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



[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://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 

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



[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: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 without 
breaking backward compatibility.

Without PEP 562, easy way is making proxy function.

# uuid/__init__.py

def uuid1(node=None, clock_seq=None):
"""Generate a UUID from a host ID, sequence number, and the current time.
If 'node' is not given, getnode() is used to obtain the hardware
address.  If 'clock_seq' is given, it is used as the sequence number;
otherwise a random 14-bit sequence number is chosen."""
from . import _uuid1 
return _uuid1.uuid1()

--
nosy: +inada.naoki

___
Python tracker 

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



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

2016-05-13 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 libFOO.so.2. However, 
for some who believes, or expects, to be able to deal with potential ABI 
changes - they can specify simply libFOO.so and let the loader decide 
(what I see is that libFOO.so is a symbolic link to, or a copy of the 
latest version.)

So, I agree wholeheartedly, if a versioned number is requested, that, or 
nothing, should be returned. However, if it is generic - try to find a 
generic named library (and get the link or copy), and when that is not 
available either, take the latest versioned number.

It has been over two months, and I may have read it wrong - but that 
appears to be what the current "ldconfig -p" solution implements. (in 
ctypes, not uuid, so perhaps this is not the correct place to be 
responding. If so, my apologies).

On 08-May-16 05:24, Martin Panter wrote:
> 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 about robustness is that if 
> a version 2 is invented, it might have different semantics or function 
> signatures, and Python would then be assuming the wrong semantics.
>
> --
>
> ___
> Python tracker 
> 
> ___

--
nosy: +aixto...@gmail.com

___
Python tracker 

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



[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 

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



[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.

--

___
Python tracker 

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



[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 about robustness is that if a version 2 is 
invented, it might have different semantics or function signatures, and Python 
would then be assuming the wrong semantics.

--

___
Python tracker 

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



[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, an advantage to calling find_library is that it should lead to an 
OSError if it cannot be loaded. But trapping OSError on a call to ctypes.cdll 
or testing for None (NULL) from find_library() is the option of a developer 
using the ctypes interface.

As far as libFOO.so.N - do you always want to assume it is going to be version 
N, or are you expecting to be able to work work version N+X?
Again, find_library() can give you the library name it would load - but a 
programmer must be aware of the platform differences (e.g., AIX returns not a 
filename, but a libFOO.a(libFOO.so.N) - as just one example.
p.s. as far as ldconfig being part of the problem on AIX (as it does not exist 
and can lead to OSError or just long delays, I have worked out a (pending) 
patch for ctypes/util (and ctypes/cdll) that may address the issues with uuid 
import on AIX. (see issue26439 for the patch)

--
nosy: +Michael.Felt

___
Python tracker 

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



[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 seems on OS X it is called libc.dylib (but it 
would be good for someone else to confirm).

# The uuid_generate_* routines are provided by libuuid on at least
# Linux and FreeBSD, and provided by libc on Mac OS X.
if sys.platform == "darwin":
libname = "libc.dylib"
else:
libname = "libuuid.so.1"
_ctypes_lib = ctypes.CDLL(libname)

--
nosy: +martin.panter

___
Python tracker 

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



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

2014-10-04 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +serhiy.storchaka
stage: needs patch - patch review
versions: +Python 3.5 -Python 3.4

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



[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 rep...@bugs.python.org
http://bugs.python.org/issue11063
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2013-02-24 Thread Jyrki Pulliainen

Changes by Jyrki Pulliainen jy...@dywypi.org:


Removed file: http://bugs.python.org/file29189/issue11063_2.patch

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



[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 rep...@bugs.python.org
http://bugs.python.org/issue11063
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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

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



[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 3.3

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



[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 rep...@bugs.python.org
http://bugs.python.org/issue11063
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2011-02-05 Thread Vetoshkin Nikita

Vetoshkin Nikita nikita.vetosh...@gmail.com 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

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



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

2011-02-05 Thread Kenny Meyer

Kenny Meyer knny.m...@gmail.com 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
Added file: http://bugs.python.org/file20685/issue11063.patch

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



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

2011-02-05 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com 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 scenarios of using uuid1/uuid5 methods in mac and 
suggesting improvements to it by your patch?

--
nosy: +orsenthil

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



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

2011-02-05 Thread R. David Murray

R. David Murray rdmur...@bitdance.com 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.

Ken: thanks for working on this.

--
nosy: +r.david.murray

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



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

2011-02-05 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr 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 statement at the top-level without a fallback

--
nosy: +pitrou
stage: needs patch - patch review

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



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

2011-02-05 Thread Vetoshkin Nikita

Vetoshkin Nikita nikita.vetosh...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue11063
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2011-02-05 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr 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 dangerous and some administrators might prefer 
to disable it (especially on shared hosting ala Google App Engine).

--

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



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

2011-02-05 Thread Kenny Meyer

Kenny Meyer knny.m...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue11063
___font face=courier new,monospaceThanks/font for pointing that out! I guess 
that is the reason you did the import in a try block.br
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2011-02-05 Thread Vetoshkin Nikita

Vetoshkin Nikita nikita.vetosh...@gmail.com 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 ctypes seems to be the best choice: it's portable across Python VMs (better 
that 3) and faster (better than 1).

--

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



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

2011-02-05 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr 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 in extension
 
 And ctypes seems to be the best choice: it's portable across Python
 VMs (better that 3) and faster (better than 1).

Perhaps, but doing without ctypes should still be possible, otherwise
it's a regression.

--

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



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

2011-02-05 Thread Keith Dart

Keith Dart ke...@dartworks.biz 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 the netlink socket on Linux, so it shouldbe 
possible to use that for getting MAC address on Linux.

--

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



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

2011-02-05 Thread Vetoshkin Nikita

Vetoshkin Nikita nikita.vetosh...@gmail.com 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

--

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



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

2011-02-05 Thread Kenny Meyer

Changes by Kenny Meyer knny.m...@gmail.com:


Removed file: http://bugs.python.org/file20687/unnamed

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



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

2011-02-05 Thread Keith Dart

Keith Dart ke...@dartworks.biz 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 rep...@bugs.python.org
http://bugs.python.org/issue11063
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2011-02-05 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr 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 tracker rep...@bugs.python.org
http://bugs.python.org/issue11063
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2011-02-04 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +eric.araujo

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



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

2011-01-29 Thread Keith Dart

New submission from Keith Dart keith.d...@gmail.com:

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, when the first UUID is actually requested. In general, 
imports should avoid unnecessary system call side effects. This also makes 
testing easier.

--
components: Library (Lib)
messages: 127442
nosy: Keith.Dart
priority: normal
severity: normal
status: open
title: uuid.py module import has heavy side effects
type: resource usage
versions: Python 2.7

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



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

2011-01-29 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



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

2011-01-29 Thread Keith Dart

Changes by Keith Dart keith.d...@gmail.com:


--
nosy: +kdart

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



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

2011-01-29 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
keywords: +easy
stage:  - needs patch
versions: +Python 3.2, Python 3.3

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