[Patches] [ python-Patches-554807 ] Add _winreg support for Cygwin

noreply@sourceforge.net noreply@sourceforge.net
Tue, 30 Jul 2002 07:04:41 -0700


Patches item #554807, was opened at 2002-05-11 12:01
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=554807&group_id=5470

Category: Windows
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Gerald S. Williams (gsw_agere)
Assigned to: Nobody/Anonymous (nobody)
Summary: Add _winreg support for Cygwin

Initial Comment:
This adds _winreg support to Cygwin Python without 
dependencies on other Windows modules.

For platforms in which MS_WINDOWS isn't defined, this 
reports the OSError exception instead of WindowsErr. 
It also uses the non-MBCS versions of registry access 
in this case.

Some minor changes to _winreg.c were made to clean up 
compiler warnings from GCC.

setup.py was changed to create a dynamic _winreg 
module under cygwin. There are also some earlier 
changes in the patch file to skip the import test (due 
to Cygwin fork issues), and to require libintl when 
building _locale under Cygwin.

----------------------------------------------------------------------

>Comment By: Gerald S. Williams (gsw_agere)
Date: 2002-07-30 14:04

Message:
Logged In: YES 
user_id=329402

I plan to get back to this eventually, although held off for three 
reasons:
 - Cygwin is incorporating a registry file system that may be a 
better way to implement this
 - saw some posts about possible Unicode changes
 - Real Life (job priorities, vacation)

I probably won't get back to this until the middle of August.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-07-28 10:02

Message:
Logged In: YES 
user_id=21627

Is any kind of tweaking forthcoming?

----------------------------------------------------------------------

Comment By: Gerald S. Williams (gsw_agere)
Date: 2002-05-15 13:30

Message:
Logged In: YES 
user_id=329402

It sounds like the patches need some tweaking (my testing 
had passed but was certainly limited).

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-05-15 12:57

Message:
Logged In: YES 
user_id=21627

Yes, but you are wrong assuming that the *A functions expect
Latin-1. Instead, they expect char* encoded as CP_ACP, which
is known as "mbcs" in Python.

The *W functions do *not* expect multi-byte strings, but
Unicode strings.

Notice that _winreg also calls the *A functions, even in
MSVC builds.

So I think converting Unicode to Latin-1 is definitely
incorrect.

----------------------------------------------------------------------

Comment By: Gerald S. Williams (gsw_agere)
Date: 2002-05-15 12:48

Message:
Logged In: YES 
user_id=329402

Windows supplies two versions of the relevant functions. 
The Cygwin version (at least as built) uses the ANSI 
versions, as indicated by the A at the end of the symbol 
names:
  $ nm _winreg.o | grep RegQueryValue
           U _RegQueryValueA@16
           U _RegQueryValueExA@24

As opposed to the "Windows Unicode/wide-char" functions, 
which end in W and require MBCS functions to decode.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-05-14 22:23

Message:
Logged In: YES 
user_id=21627

Can you please explain why not using MBCS is the right thing?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=554807&group_id=5470