This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Solaris error doing a print
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: anthonybaxter, barry, hobbs, loewis, mhammond
Priority: high Keywords:

Created on 2003-07-23 00:18 by mhammond, last changed 2022-04-10 16:10 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
sys.diff loewis, 2003-07-23 05:16
Messages (10)
msg17273 - (view) Author: Mark Hammond (mhammond) * (Python committer) Date: 2003-07-23 00:18
As seen on Jeff Hobb's box.

print "Registering '%s' (%s)" % (reg_contractid, fname)
  File
"/usr/local/python-2.3/lib/python2.3/encodings/__init__.py",
line 84, in search_function
    globals(), locals(), _import_tail)
ValueError: Empty module name

It seems that this shell has an empty "LANG" var setup
- deleting this var seems to solve the problem.

Looking in sysmodule.c, I see:

	if(codeset && isatty(fileno(stdin))){
(and a similar one for stdout).  Should this be:
	if(codeset && *codeset && isatty(fileno(stdin))){

to prevent an empty name?  Or better, should we check
the encoding is actually installed?

I will mail Jeff and ask him to attach comments on the
version or anything else.
msg17274 - (view) Author: Jeffrey Hobbs (hobbs) Date: 2003-07-23 00:26
Logged In: YES 
user_id=72656

python 2.3rc1, build --enable-shared.

Solaris uname -a:
SunOS knife 5.6 Generic_105181-05 sun4u sparc SUNW,Ultra-
250
msg17275 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-07-23 05:16
Logged In: YES 
user_id=21627

I'm tempted to declare this a platform bug: Both Linux and
later Solaris versions set the CODEPAGE to ASCII for an
empty LANG (i.e. assume this is the "C" locale).

Still, checking whether the encoding is present is probably
a good idea. Unfortunately, it cannot be done right there,
since loading of codecs does not work yet inside _PySys_Init.

So as a work-around for 2.3, we should check for non-empty
strings, and leave checking for supported encodings for 2.3.1.
Patch attached.
msg17276 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2003-07-29 03:15
Logged In: YES 
user_id=12800

Before I can comment on this for 2.3 (and time is very
quickly running out), can you provide:

1. a recipe to reproduce this on RH9 or other Linux?  I
tried in bash:

% export LANG=""
% ./python
>>> print "foo"
foo
>>>

i.e. nothing happened, so I'm sure I'm not doing this right.
 Also, any possibility of a test case?
msg17277 - (view) Author: Jeffrey Hobbs (hobbs) Date: 2003-07-29 04:08
Logged In: YES 
user_id=72656

I think you have to unset LANG rather than set to "", but I'm 
not really understanding this one, so I defer to Mark.
msg17278 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-07-29 04:35
Logged In: YES 
user_id=21627

This is not reproducable on Linux. nl_langinfo(CODESET) will
always give a non-empty string. If LANG is not set, the user
thereby requests the "POSIX" locale, and its codeset is
ANSI_X3.4-1968.

So it *is* a bug in that Solaris version that it returns an
empty string; the empty string is a valid return value only
if the argument to nl_langinfo was invalid. Since the system
does support querying the CODESET in principle, it should
not be possible to ever get an empty string.
msg17279 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2003-07-29 04:42
Logged In: YES 
user_id=12800

I'm taking this to mean <wink> that there's nothing
showstopping for Python 2.3 final here.  If we want to
implement the workaround for the Solaris bug in 2.3.1, then
we can do that when we have some breathing room.  Lowering
the priority.
msg17280 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2003-07-29 04:49
Logged In: YES 
user_id=29957

I can't reproduce this on Solaris 2.6 (x86 version).

<anthony@star>$ env LANG="" ./python
Python 2.3 (#1, Jul 29 2003, 04:41:38) 
[GCC egcs-2.91.57 19980901 (egcs-1.1 release)] on sunos5
Type "help", "copyright", "credits" or "license" for more
information.
>>> print "hello world"
hello world
>>> ^D
<anthony@star>$ uname -a
SunOS star 5.6 Generic_105182-05 i86pc i386 i86pc

I also tried unsetting LANG, setting it to the empty string,
to a single space, and was unable to get any problems to
show. It also doesn't show on Solaris 2.7 (sparc) - I no
longer have any sparcs running 2.6.

I'd say it's safe to lower the priority and miss this one
for 2.3.

msg17281 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2003-07-29 05:07
Logged In: YES 
user_id=29957

woops. I accidently reset the priority (overlapping commit)
msg17282 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-08-09 09:50
Logged In: YES 
user_id=21627

This should now be fixed in

pythonrun.c 2.196
sysmodule.c 2.121

NEWS 1.831.4.11
pythonrun.c 2.195.6.1
sysmodule.c 2.120.6.1

As I can't reproduce the problem, I cannot verify whether
the fix is effective. Please reopen if the problem persists.
History
Date User Action Args
2022-04-10 16:10:10adminsetgithub: 38909
2003-07-23 00:18:05mhammondcreate