Re: [Python-Dev] cpython (2.7): Issue #14448: mention pytz; patch by Andrew Svetlov

2012-04-25 Thread Georg Brandl
On 24.04.2012 19:48, sandro.tosi wrote:
> http://hg.python.org/cpython/rev/e0e421133d0f
> changeset:   76532:e0e421133d0f
> branch:  2.7
> parent:  76527:22767284de99
> user:Sandro Tosi 
> date:Tue Apr 24 19:43:33 2012 +0200
> summary:
>   Issue #14448: mention pytz; patch by Andrew Svetlov
> 
> files:
>   Doc/library/datetime.rst |  8 
>   1 files changed, 8 insertions(+), 0 deletions(-)
> 
> 
> diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst
> --- a/Doc/library/datetime.rst
> +++ b/Doc/library/datetime.rst
> @@ -1521,6 +1521,14 @@
>  other fixed-offset :class:`tzinfo` subclass (such as a class representing 
> only
>  EST (fixed offset -5 hours), or only EDT (fixed offset -4 hours)).
>  
> +.. seealso::
> +
> +   `pytz `_
> +  The Standard Library has no :class:`tzinfo` instances except for UTC, 
> but

  we don't capitalize "standard library"

> +  it exists a third-party library which brings Olson timezone database to

 ^^ there^ the

Also, I'm not sure everybody knows what the "Olson database" is, so maybe that
should be explained too.

cheers,
Georg

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] [Python-checkins] Daily reference leaks (a2cf07135e4f): sum=6

2012-04-25 Thread Mark Shannon

[email protected] wrote:

results for a2cf07135e4f on branch "default"


test_tempfile leaked [2, 2, 2] references, sum=6



These leaks are due to 6e5855854a2e: “Implement
PEP 412: Key-sharing dictionaries (closes #13903)”.

They both occur in tests for tempfile.TemporaryDirectory,
although I don't know what is special about that code.

I'll investigate further when I have time.

Cheers,
Mark.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] cpython (2.7): Issue #14448: mention pytz; patch by Andrew Svetlov

2012-04-25 Thread Sandro Tosi
Hi Georg,
thanks for the review!

On Wed, Apr 25, 2012 at 09:37, Georg Brandl  wrote:
> On 24.04.2012 19:48, sandro.tosi wrote:
>> http://hg.python.org/cpython/rev/e0e421133d0f
>> changeset:   76532:e0e421133d0f
>> branch:      2.7
>> parent:      76527:22767284de99
>> user:        Sandro Tosi 
>> date:        Tue Apr 24 19:43:33 2012 +0200
>> summary:
>>   Issue #14448: mention pytz; patch by Andrew Svetlov
>>
>> files:
>>   Doc/library/datetime.rst |  8 
>>   1 files changed, 8 insertions(+), 0 deletions(-)
>>
>>
>> diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst
>> --- a/Doc/library/datetime.rst
>> +++ b/Doc/library/datetime.rst
>> @@ -1521,6 +1521,14 @@
>>  other fixed-offset :class:`tzinfo` subclass (such as a class representing 
>> only
>>  EST (fixed offset -5 hours), or only EDT (fixed offset -4 hours)).
>>
>> +.. seealso::
>> +
>> +   `pytz `_
>> +      The Standard Library has no :class:`tzinfo` instances except for UTC, 
>> but
>
>              we don't capitalize "standard library"
>
>> +      it exists a third-party library which brings Olson timezone database 
>> to
>
>         ^^ there                                    ^ the

sigh, you're right: I'll fix them once the below point is clarified

> Also, I'm not sure everybody knows what the "Olson database" is, so maybe that
> should be explained too.

I had considered that, but then I found another reference of "Olson
database" in an example right before the seealso note, so I left it as
it is. On a second thought, it might be better to clarify what Olson
db is, do you think a link (f.e to here:
http://www.iana.org/time-zones ) could be enough or (or in addition)
also a brief note is needed?

cheers,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] cpython: Implement PEP 412: Key-sharing dictionaries (closes #13903)

2012-04-25 Thread Kristján Valur Jónsson


> -Original Message-
> From: [email protected]
> [mailto:[email protected]] On
> Behalf Of [email protected]
> Sent: 24. apríl 2012 17:44
> To: [email protected]
> Subject: Re: [Python-Dev] cpython: Implement PEP 412: Key-sharing
> dictionaries (closes #13903)
> 
> > Benchmarks should measure memory usage too, of course.  Sadly that is
> > not possible in standard cPython.
> 
> It's actually very easy in standard CPython, using sys.getsizeof.
>
Yes, you can query each python object about how big it thinks it is.
What I'm speaking of is more like:
start_allocs, start_mem = allocator.get_current()
allocator.reset_limits()
run_complicated_tests()

end_allocs, end_mem = allocator.get=current()

Print "delta blocks: %d, delta mem: %d"%(end_allocs-start_allocs, 
end_mem-start_mem)
print "peak blocks: %d, peak mem: %d"%allocator.peak()

 
> > Btw, this is of great interest to me at the moment, our Shanghai
> > engineers are screaming at the memory waste incurred by dictionaries.
> > A 10 item dictionary consumes 1/2k on 32 bits, did you know this?
> 
> I did.
> 
> In Python 3.3, this now goes down to 248 bytes (32 bits).
> 
I'm going to experiment with tunable parameters in 2.7 to trade performance for 
memory.  In some applications, memory trumps performance.

K

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] cpython: Implement PEP 412: Key-sharing dictionaries (closes #13903)

2012-04-25 Thread Mark Shannon

Kristján Valur Jónsson wrote:



-Original Message-
From: [email protected]
[mailto:[email protected]] On
Behalf Of [email protected]
Sent: 24. apríl 2012 17:44
To: [email protected]
Subject: Re: [Python-Dev] cpython: Implement PEP 412: Key-sharing
dictionaries (closes #13903)


Benchmarks should measure memory usage too, of course.  Sadly that is
not possible in standard cPython.

It's actually very easy in standard CPython, using sys.getsizeof.


Yes, you can query each python object about how big it thinks it is.
What I'm speaking of is more like:
start_allocs, start_mem = allocator.get_current()
allocator.reset_limits()
run_complicated_tests()

end_allocs, end_mem = allocator.get=current()

Print "delta blocks: %d, delta mem: %d"%(end_allocs-start_allocs, 
end_mem-start_mem)
print "peak blocks: %d, peak mem: %d"%allocator.peak()


Take a look at the benchmark suite at
http://hg.python.org/benchmarks/
The test runner has an -m option that profiles memory usage,
you could take a look at how that is implemented

Cheers,
Mark.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] cpython (2.7): Issue #14448: mention pytz; patch by Andrew Svetlov

2012-04-25 Thread Nick Coghlan
On Wed, Apr 25, 2012 at 6:21 PM, Sandro Tosi  wrote:
> On Wed, Apr 25, 2012 at 09:37, Georg Brandl  wrote:
>> Also, I'm not sure everybody knows what the "Olson database" is, so maybe 
>> that
>> should be explained too.
>
> I had considered that, but then I found another reference of "Olson
> database" in an example right before the seealso note, so I left it as
> it is. On a second thought, it might be better to clarify what Olson
> db is, do you think a link (f.e to here:
> http://www.iana.org/time-zones ) could be enough or (or in addition)
> also a brief note is needed?

I think another "see also" with a link to that page would be
appropriate. With maintenance of the database transferred to the IANA,
I'd also rephrase the reference as the "IANA timezone database (also
known as the Olson database)"

Cheers,
Nick.

-- 
Nick Coghlan   |   [email protected]   |   Brisbane, Australia
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] cpython: Implement PEP 412: Key-sharing dictionaries (closes #13903)

2012-04-25 Thread Kristján Valur Jónsson


> -Original Message-
> Take a look at the benchmark suite at
> http://hg.python.org/benchmarks/
> The test runner has an -m option that profiles memory usage, you could take
> a look at how that is implemented
>

Yes, out of process monitoring of memory as reported by the OS.  We do gather 
those counters as well on clients and servers.
But they don't give you the granularity you want when checking for memory leaks 
and memory usage by certain algorithms.
In the same way that the unittests have reference leak reports, they could just 
have memory usage reports, if the underlying allocator supported that.

FYI the current state of affairs of the cPython 2.7 branch we use is as follows:
1) We allow the API user to specify the base allocator python uses, both for 
regular allocs and allocating blocks for the obmalloc one, using:

/* Support for custom allocators */
typedef void *(*PyCCP_Malloc_t)(size_t size, void *arg, const char *file, int 
line, const char *msg);
typedef void *(*PyCCP_Realloc_t)(void *ptr, size_t size, void *arg, const char 
*file, int line, const char *msg);
typedef void (*PyCCP_Free_t)(void *ptr, void *arg, const char *file, int line, 
const char *msg);
typedef size_t (*PyCCP_Msize_t)(void *ptr, void *arg);
typedef struct PyCCP_CustomAllocator_t
{
PyCCP_Malloc_t  pMalloc;
PyCCP_Realloc_t pRealloc;
PyCCP_Free_tpFree;
PyCCP_Msize_t   pMsize;/* can be NULL, or return -1 if no size info is 
avail. */
void*arg;  /* opaque argument for the functions */
} PyCCP_CustomAllocator_t;

/* To set an allocator!  use 0 for the regular allocator, 1 for the block 
allocator.
 * pass a null pointer to reset to internal default
 */
PyAPI_FUNC(void) PyCCP_SetAllocator(int which, const PyCCP_CustomAllocator_t 
*); /* for BLUE to set the current context */

/* internal data member */
extern PyCCP_CustomAllocator_t _PyCCP_CustomAllocator[];

2) using ifdefs, the macros will delegate all final allocations through these 
allocators.  This includes all the "naked" malloc calls scattered about, they 
are patched up using #defines.

3) Additionally, there is an internal layer of management, before delegating to 
the external allocators.  This internal manager provides statistics, exposed 
through the "sys" module.

The layering is something like this, all more or less definable by 
pre-processor macros. (raw malloc() is turned into something else via 
pre-processor magic and a special "patch_malloc.h" file added to the modules 
which uses raw malloc())

  PyMem_Malloc() PyObject_Malloc()
|   |
v   v
   Mem bookkeeping   obj bookkeeping
|   |
|   v
 malloc()   | obmallocator
|   |   |
v   v   v
  PyMem_MALLOC_RAW() PyObject_MALLOC_RAW
   |   |
   v   v
 malloc() or vectored allocator specified through API function


Cheers,

K

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] [Python-checkins] cpython: Fix #3561. Add an option to place the Python installation into the Windows Path

2012-04-25 Thread Brian Curtin
On Wed, Apr 25, 2012 at 08:13, brian.curtin  wrote:
> http://hg.python.org/cpython/rev/4e9f1017355f
> changeset:   76556:4e9f1017355f
> user:        Brian Curtin 
> date:        Wed Apr 25 08:12:37 2012 -0500
> summary:
>  Fix #3561. Add an option to place the Python installation into the Windows 
> Path environment variable.
>
> files:
>  Misc/NEWS        |   3 +++
>  Tools/msi/msi.py |  22 +++---
>  2 files changed, 22 insertions(+), 3 deletions(-)

http://bugs.python.org/issue14668 was created for updating the
relevant documentation.

I pushed without docs since it's unlikely they'll be done before the
weekend's alpha 3 build, and I didn't want to have this feature wait
an extra month before anyone sees it. Anyone who's installing an alpha
build is probably advanced enough to know what it's doing in the
meantime.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Building against system expat

2012-04-25 Thread Bohuslav Kabrda
Hi, I'm trying to build Python 3.2.3 against system expat library, that lies 
out of the ordinary directory structure (under /opt). I also have an older 
version of expat library in the system. No matter what shell variables or 
options I pass to configure and make, pyexpat gets linked against the system 
expat, which results in errors during tests:

pyexpat.cpython-32dmu.so: undefined symbol: XML_SetHashSalt

anyone has any idea what to pass to configure/make to link pyexpat with the 
other expat?

Thanks!

-- 
Regards,
Bohuslav "Slavek" Kabrda.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Building against system expat

2012-04-25 Thread Bohuslav Kabrda
Hi, I'm trying to build Python 3.2.3 against system expat library, that lies 
out of the ordinary directory structure (under /opt). I also have an older 
version of expat library in the system. No matter what shell variables or 
options I pass to configure and make, pyexpat gets linked against the system 
expat, which results in errors during tests:

pyexpat.cpython-32dmu.so: undefined symbol: XML_SetHashSalt

anyone has any idea what to pass to configure/make to link pyexpat with the 
other expat?

Thanks!

-- 
Regards,
Bohuslav "Slavek" Kabrda.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] netiquette on py-dev

2012-04-25 Thread Barry Warsaw
On Apr 25, 2012, at 12:44 PM, Stephen J. Turnbull wrote:

>Note that people who are really annoyed by the duplicates can set
>their Mailman accounts to no-dupes, and Mailman won't send the post to
>that person.  (This has its disadvantages in principle -- no List-*
>headers and other list-specific info -- and in implementation -- at
>best Mailman can change all your lists at one site, so you need to do
>this on every site you subscribe to.  But it's an option.)

Exactly.  My MUA has a reply-to-list that really only works if there's a
List-Post header.  If you reply to one of my list messages and include me in
the CC, I won't get the list copy so I won't get the List-Post header.  Then
my response back will include you in the CC.  I generally won't clean these
up, since it's *your* fault you're getting a dupe. :)

If you reply-to-list and don't CC me, then the copy I get will be the list
copy, which will have a List-Post header, and I'll also reply-to-list.  No
dupes in sight, just like this one.  SJT, FTW.

-Barry
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] netiquette on py-dev

2012-04-25 Thread Barry Warsaw
On Apr 25, 2012, at 01:58 PM, Chris Angelico wrote:

>I go the other way: hit Reply, and then replace the author's address
>with the list's. I'd much rather have a Reply List though.
>Unfortunately no decent webmail seems to have it, and I'm still
>looking for a decent non-web-mail client too.

It's a highly religious and platform-dependent thing.  I'll put in a plug for
Claws Mail, which I use and generally find to be excellent, in that its warts
(which they all have) aren't bad enough to make me want to chuck my laptop out
the window.  It does both IMAP and NNTP pretty well, and can call an external
editor for composition.  It also rarely crashes these days. :)

Oh, and to keep things roughly on topic, it embeds Python so you can write
nice little scripts for a variety of actions.  E.g. I have a little Python
script to automatically pick my python.org address for messages to Python
mailing lists.

That's all I'll say on the subject in this mailing list, but I'm happy to
answer other questions off-line.

-Barry
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (time) PEP 418 glossary V2

2012-04-25 Thread Steven D'Aprano

Stephen J. Turnbull wrote:

On Wed, Apr 25, 2012 at 1:19 AM, Jim Jewett  wrote:


I'm still a little fuzzy on *why* it shouldn't count as a monotonic
clock.


So are the people who say it shouldn't count (unless you're speaking
of the specific implementation on Unix systems, which can go backward
if the admin or NTP decides it should be so).


The fact that the clock is not monotonic is a pretty good reason for it not to 
count as monotonic. I don't think there's anything fuzzy about that.




I think they are in
general mistaking their use case for a general specification, that's
all.


I'm sorry, am I missing something here? What use case are you talking about?



Even Glyph cited "what other people seem to think" in supporting
the usage where "monotonic" implies "high quality" in some informal
sense, although he does have a spec for what high quality means, and
AIUI an API for it in Twisted.


Who are these people who think monotonic is a synonym for "high quality"?

Why should we pander to their confusion at the cost of those who do understand 
the difference between monotonic and high quality?




I think we should just accept that "monotonic" is in more or less
common use as a synonym for "high quality", and warn *our* users that
the implementers of such clocks may be working to a different spec.  I
think the revised glossary's description of "monotonic" does that
pretty well.


Do I understand correctly that you think it is acceptable to call something 
monotonic regardless of whether or not it actually is monotonic?


If not, I'm not sure I understand what you are suggesting here.



--
Steven

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] cpython (2.7): Issue #14448: mention pytz; patch by Andrew Svetlov

2012-04-25 Thread Sandro Tosi
On Wed, Apr 25, 2012 at 11:55, Nick Coghlan  wrote:
> On Wed, Apr 25, 2012 at 6:21 PM, Sandro Tosi  wrote:
>> On Wed, Apr 25, 2012 at 09:37, Georg Brandl  wrote:
>>> Also, I'm not sure everybody knows what the "Olson database" is, so maybe 
>>> that
>>> should be explained too.
>>
>> I had considered that, but then I found another reference of "Olson
>> database" in an example right before the seealso note, so I left it as
>> it is. On a second thought, it might be better to clarify what Olson
>> db is, do you think a link (f.e to here:
>> http://www.iana.org/time-zones ) could be enough or (or in addition)
>> also a brief note is needed?
>
> I think another "see also" with a link to that page would be
> appropriate. With maintenance of the database transferred to the IANA,
> I'd also rephrase the reference as the "IANA timezone database (also
> known as the Olson database)"

Ah yes, I like that; what about this change (where the IANA tz db
section is brutally copied from their website):

diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst
--- a/Doc/library/datetime.rst
+++ b/Doc/library/datetime.rst
@@ -1524,12 +1524,19 @@
 .. seealso::

`pytz `_
-  The Standard Library has no :class:`tzinfo` instances except for UTC, but
-  it exists a third-party library which brings Olson timezone database to
-  Python: `pytz`.
+  The standard library has no :class:`tzinfo` instances except for UTC, but
+  there exists a third-party library which brings the `IANA timezone
+  database` (also known as the Olson database) to Python: `pytz`.

   `pytz` contains up-to-date information and its usage is recommended.

+   `IANA timezone database `_
+  The Time Zone Database (often called tz or zoneinfo) contains code and
+  data that represent the history of local time for many representative
+  locations around the globe. It is updated periodically to reflect changes
+  made by political bodies to time zone boundaries, UTC offsets, and
+  daylight-saving rules.
+
 .. _strftime-strptime-behavior:

Cheers,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] cpython (2.7): Issue #14448: mention pytz; patch by Andrew Svetlov

2012-04-25 Thread Georg Brandl
On 25.04.2012 19:21, Sandro Tosi wrote:
> On Wed, Apr 25, 2012 at 11:55, Nick Coghlan  wrote:
>> On Wed, Apr 25, 2012 at 6:21 PM, Sandro Tosi  wrote:
>>> On Wed, Apr 25, 2012 at 09:37, Georg Brandl  wrote:
 Also, I'm not sure everybody knows what the "Olson database" is, so maybe 
 that
 should be explained too.
>>>
>>> I had considered that, but then I found another reference of "Olson
>>> database" in an example right before the seealso note, so I left it as
>>> it is. On a second thought, it might be better to clarify what Olson
>>> db is, do you think a link (f.e to here:
>>> http://www.iana.org/time-zones ) could be enough or (or in addition)
>>> also a brief note is needed?
>>
>> I think another "see also" with a link to that page would be
>> appropriate. With maintenance of the database transferred to the IANA,
>> I'd also rephrase the reference as the "IANA timezone database (also
>> known as the Olson database)"
> 
> Ah yes, I like that; what about this change (where the IANA tz db
> section is brutally copied from their website):
> 
> diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst
> --- a/Doc/library/datetime.rst
> +++ b/Doc/library/datetime.rst
> @@ -1524,12 +1524,19 @@
>  .. seealso::
> 
> `pytz `_
> -  The Standard Library has no :class:`tzinfo` instances except for UTC, 
> but
> -  it exists a third-party library which brings Olson timezone database to
> -  Python: `pytz`.
> +  The standard library has no :class:`tzinfo` instances except for UTC, 
> but
> +  there exists a third-party library which brings the `IANA timezone
> +  database` (also known as the Olson database) to Python: `pytz`.
> 
>`pytz` contains up-to-date information and its usage is recommended.

BTW, the single backticks don't do anything usable; use *pytz* to make something
emphasized.

> +   `IANA timezone database `_
> +  The Time Zone Database (often called tz or zoneinfo) contains code and
> +  data that represent the history of local time for many representative
> +  locations around the globe. It is updated periodically to reflect 
> changes
> +  made by political bodies to time zone boundaries, UTC offsets, and
> +  daylight-saving rules.
> +

Maybe it's useful to mention that that database is the one used on Linux (is
it on other Unices?) and Windows has its own?

Georg

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Python 2.7.3 shared library, like _socket.pyd, cannot be loaded

2012-04-25 Thread Terry Tang
Hi There,

I am integrating Python 2.7.3 into our system on Windows. We embedded Python 
2.7.3 interpreter to our system.

The problem we met is, our extended Python interpreter cannot load 
"_socket.pyd" when "import socket" is executed, for example. Here is the error:

Traceback (most recent call last):
  File "t.py", line 1, in 
    import socket;
  File "C:\trunk1\third_party\python-2.7.3\win32\lib\socket.py", line 47, in 
    import _socket
ImportError: DLL load failed: The specified module could not be found.


I wrote a small program as listed below to manually load "_socket.pyd" from 
Python 2.7.3 binary installation  on Windows, and got the same failure.

static void TestDllLoad(const char *dllPath)
{
    HINSTANCE 
socketh=LoadLibraryEx(dllPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
    if (socketh == NULL) {

fprintf(stderr, "Failed to load shared library: %s\nError: %d\n", dllPath,  
GetLastError());
    } else {
fprintf(stderr, "Successfully load shared library: %s\n", dllPath);
    }
}

int main()
{
    /* The following loading success. */
    TestDllLoad("\\DLLs\\_socket.pyd");
    /* The following loading failed. */
    TestDllLoad("\\DLLs\\_socket.pyd");
    return 0;}

I tried MSVC 2008 and a third-party compiler, and got the same result, even 
after copying "python27.dll" to the testing directory from Python 2.7.3 
installation on Windows.

There is a similar failure reported in http://bugs.python.org/issue4566, but it 
is marked as fixed and closed. 

Anyone has any idea about the problem?

Thanks a lot.

-Terry___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Building against system expat

2012-04-25 Thread Georg Brandl
On 25.04.2012 15:42, Bohuslav Kabrda wrote:
> Hi, I'm trying to build Python 3.2.3 against system expat library, that lies
> out of the ordinary directory structure (under /opt). I also have an older
> version of expat library in the system. No matter what shell variables or
> options I pass to configure and make, pyexpat gets linked against the system
> expat, which results in errors during tests:
> 
> pyexpat.cpython-32dmu.so: undefined symbol: XML_SetHashSalt
> 
> anyone has any idea what to pass to configure/make to link pyexpat with the
> other expat?

You'll have to upgrade your expat.  The XML_SetHashSalt is new in 2.1.0 and
makes it possible to avoid an algorithmic complexity attack; Python uses it
in its newest bugfix releases.  See for example 
.

cheers,
Georg

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] cpython: Implement PEP 412: Key-sharing dictionaries (closes #13903)

2012-04-25 Thread Martin v. Löwis

Benchmarks should measure memory usage too, of course.  Sadly that is
not possible in standard cPython.


It's actually very easy in standard CPython, using sys.getsizeof.


Yes, you can query each python object about how big it thinks it is.
What I'm speaking of is more like:
start_allocs, start_mem = allocator.get_current()
allocator.reset_limits()
run_complicated_tests()

end_allocs, end_mem = allocator.get=current()


This is easy in a debug build, using sys.getobjects(). In a release 
build, you can use pympler:


start = pympler.muppy.get_size(pympler.muppy.get_objects())
run_complicated_tests()
end = pympler.muppy.get_size(pympler.muppy.get_objects())
print "delta mem: %d" % (end-start)

Regards,
Martin
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] [help wanted] - IrDA sockets support

2012-04-25 Thread Charles-François Natali
Hi,

Issue #1522400 (http://bugs.python.org/issue1522400) has a patch
adding IrDA socket support.
It builds under Linux and Windows, however it cannot go any further
because no developer involved in the issue has access to IrDA capable
devices, which makes testing impossible.
So, if you have access to such devices and are interested, feel free
to chime in and help get this merged.

Cheers,

cf
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Building against system expat

2012-04-25 Thread Georg Brandl
On 25.04.2012 20:44, Georg Brandl wrote:
> On 25.04.2012 15:42, Bohuslav Kabrda wrote:
>> Hi, I'm trying to build Python 3.2.3 against system expat library, that lies
>> out of the ordinary directory structure (under /opt). I also have an older
>> version of expat library in the system. No matter what shell variables or
>> options I pass to configure and make, pyexpat gets linked against the system
>> expat, which results in errors during tests:
>> 
>> pyexpat.cpython-32dmu.so: undefined symbol: XML_SetHashSalt
>> 
>> anyone has any idea what to pass to configure/make to link pyexpat with the
>> other expat?
> 
> You'll have to upgrade your expat.  The XML_SetHashSalt is new in 2.1.0 and
> makes it possible to avoid an algorithmic complexity attack; Python uses it
> in its newest bugfix releases.  See for example 
> .

Sorry, I think I misread your request.  Please ignore the reply.

Georg

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Python 3 porting

2012-04-25 Thread Barry Warsaw
I want to take this opportunity to make folks aware of several Python 3
porting initiatives and resources.

In Ubuntu 12.10, we are going to be making a big push to target all the
applications and libraries on the desktop CDs to Python 3.  While this is a
goal of Ubuntu, the intent really is to work with the wider Python community
(i.e. *you*!) to help drive more momentum toward Python 3.

We can't do this alone, and we hope you will participate.  While we on Ubuntu
have our own list of priorities, of course we want to push as much of this as
possible upstream so that everyone can benefit, regardless of platform.  We
also want to help spread the word about Python 3, and how easy it can be to
support it.

One of the best ways to get involved is to join the 'python-porting' mailing
list:

http://mail.python.org/mailman/listinfo/python-porting

which is *the* forum for discussion issues, getting help, and coordinating
with others on Python 3 ports of your favorite upstream projects.

I've also resurrected the #python3 IRC channel on Freenode, for those of you
who want to provide or receive more real-time help.

Web resources for porters include:

 * http://getpython3.com/
   General Python 3 resources, forkable on github

 * http://python3porting.com/
   Lennart Regebro's excellent in-depth porting guide

 * https://wiki.ubuntu.com/Python/3
   My quick guide for porting

 * https://wiki.ubuntu.com/Python/FoundationsQPythonVersions
   Detailed plans for Python 3 on Ubuntu 12.10

 * http://tinyurl.com/6vm3egu
   My recent blog post on Ubuntu's plans for Python 3

 * http://tinyurl.com/7dsyywo
   Ubuntu's top priorities for porting, as a shared Google doc spreadsheet

Many of these pages have additional links and resources for porting, and can
help you find packages that need resources in getting to Python 3.

At the Ubuntu Developer Summit in Oakland, California, May 7-11, 2012, we'll
also be holding some sessions on Python 3, so if you're in the area, please
come by.

http://uds.ubuntu.com/

Cheers,
-Barry


signature.asc
Description: PGP signature
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Assigning copyright...

2012-04-25 Thread stefan brunthaler
Hi,

I only had little time to spend for my open sourcing efforts, which is
why I could not get back to python-dev any time earlier...

Yesterday I forward-ported my patches to revision 76549
(13c30fe3f427), which only took 25mins or so (primarly due to the
small changes necessary to Python itself and the stability of that
parts.) Thanks to a colleague of mine (Per Larsen) I reimplemented
some of the more ugly parts of the code generator, too.
Guido's answer from the last thread was that I should duly assign the
copyright to the PSF. Unfortunatly, I don't really see any other part
than the LICENSE and README files in the Python distribution. Since my
patch basically just adds another subdirectory ("cgen") to the Python
top-level directory, I am not sure if I need to supply other
information to make my code officially PSF compatible.

Am I missing something obvious?

Thanks,
--stefan
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] cpython (2.7): Issue #14448: mention pytz; patch by Andrew Svetlov

2012-04-25 Thread Nick Coghlan
On Thu, Apr 26, 2012 at 4:40 AM, Georg Brandl  wrote:
> Maybe it's useful to mention that that database is the one used on Linux (is
> it on other Unices?) and Windows has its own?

pytz always uses the Olson/IANA database. I don't think we need to
confuse matters further by mentioning the fact that Microsoft invented
their own system without worrying about what anyone else was doing.

Cheers,
Nick.

-- 
Nick Coghlan   |   [email protected]   |   Brisbane, Australia
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] netiquette on py-dev

2012-04-25 Thread Ben Finney
"Stephen J. Turnbull"  writes:

> I don't know of any webmail implementations that provide
> reply-to-list, so a lot of us end up using reply-to-all.

Right, that puts the responsibility in the right place: the webmail
software vendor needs to add a reply-to-list command, as has been
implemented in many clients for many years and supported explicitly by
standard fields in every message header.

> So in most cases I suppose that the duplicate going to the author is
> just an issue of "energy conservation" on the part of the responder.

I agree that's likely the usual reason. It's saving short-term effort by
passing that effort on to others though, and to that extent is
inconsiderate of other people.

Better is for webmail users to pressure the vendor of the webmail
software to add the “Reply to list” feature and make it clear this is
the recommended way to reply on a mailing list.

> Note that people who are really annoyed by the duplicates can set
> their Mailman accounts to no-dupes, and Mailman won't send the post to
> that person.

Those of us who don't have a Mailman account don't have that option, as
you noted. I'm not participating in this forum by email at all, and
don't expect *any* copies of its messages in my email.

The problem is with the missing feature of the webmail program, and the
users of that program need to agitate for getting it fixed.


Nick Coghlan  writes:

> So yeah, the basic problem is mail clients that don't offer a
> "Reply-List" option, with the Gmail web client being a notable
> offender.

It doesn't even need to be extra effort for the user. The “Reply to
author” command can change to a “Reply to list” command when the mailing
list fields are present. That's one possible solution; but anything that
gets more people to “Reply to list” when appropriate is acceptable to me.

-- 
 \   “Don't you try to outweird me, I get stranger things than you |
  `\  free with my breakfast cereal.” —Zaphod Beeblebrox, _The |
_o__)Restaurant At The End Of The Universe_, Douglas Adams |
Ben Finney

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Assigning copyright...

2012-04-25 Thread Éric Araujo
Hi Stefan,

The PSF does not require copyright assignment (ugh!), only a contributor
agreement.  http://www.python.org/psf/contrib/contrib-form/ should give
you all you need.

Regards
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Building against system expat

2012-04-25 Thread Bohuslav Kabrda
- Original Message -
> On 25.04.2012 15:42, Bohuslav Kabrda wrote:
> > Hi, I'm trying to build Python 3.2.3 against system expat library,
> > that lies
> > out of the ordinary directory structure (under /opt). I also have
> > an older
> > version of expat library in the system. No matter what shell
> > variables or
> > options I pass to configure and make, pyexpat gets linked against
> > the system
> > expat, which results in errors during tests:
> > 
> > pyexpat.cpython-32dmu.so: undefined symbol: XML_SetHashSalt
> > 
> > anyone has any idea what to pass to configure/make to link pyexpat
> > with the
> > other expat?
> 
> You'll have to upgrade your expat.  The XML_SetHashSalt is new in
> 2.1.0 and
> makes it possible to avoid an algorithmic complexity attack; Python
> uses it
> in its newest bugfix releases.  See for example
> .
> 
> cheers,
> Georg
> 

Thanks, actually I found an error in my build script that set the 
LD_LIBRARY_PATH wrongly, so only the standard .so file was found (that didn't 
have this symbol), and not the one under /opt.

So, my mistake,
thanks everyone :)

-- 
Regards,
Bohuslav "Slavek" Kabrda.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] sys.implementation

2012-04-25 Thread Eric Snow
The proposal of adding sys.implementation has come up a couple times
over the last few years. [1][2]  While the reaction has been
overwhelmingly positive, nothing has come of it.  I've created a
tracker issue and a patch:

http://bugs.python.org/issue14673

The patch adds a struct sequence that holds ("name" => "CPython",
"version" => sys.version_info).  If later needs dictate more fields,
we can cross that bridge then.

Are there any objections?  Considering the positive reaction and the
scope of the addition, does this need a PEP?

-eric

[1] http://mail.python.org/pipermail/python-dev/2009-October/092893.html
[2] http://mail.python.org/pipermail/python-ideas/2012-April/014878.html
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Assigning copyright...

2012-04-25 Thread Mark Shannon

stefan brunthaler wrote:

Hi,

I only had little time to spend for my open sourcing efforts, which is
why I could not get back to python-dev any time earlier...

Yesterday I forward-ported my patches to revision 76549
(13c30fe3f427), which only took 25mins or so (primarly due to the
small changes necessary to Python itself and the stability of that
parts.) Thanks to a colleague of mine (Per Larsen) I reimplemented
some of the more ugly parts of the code generator, too.
Guido's answer from the last thread was that I should duly assign the
copyright to the PSF. Unfortunatly, I don't really see any other part
than the LICENSE and README files in the Python distribution. Since my
patch basically just adds another subdirectory ("cgen") to the Python
top-level directory, I am not sure if I need to supply other
information to make my code officially PSF compatible.

Am I missing something obvious?


A URL for the code repository (with an open-source license),
so code can be reviewed.
It is hard to review and update a giant patch.

Cheers,
Mark.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com