Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_tkinter.c doesn't build on Redhat 9 #38292

Closed
nnorwitz mannequin opened this issue Apr 11, 2003 · 5 comments
Closed

_tkinter.c doesn't build on Redhat 9 #38292

nnorwitz mannequin opened this issue Apr 11, 2003 · 5 comments
Assignees
Labels
build The build process and cross-build

Comments

@nnorwitz
Copy link
Mannequin

nnorwitz mannequin commented Apr 11, 2003

BPO 719880
Nosy @loewis

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/loewis'
closed_at = <Date 2003-04-16.20:55:04.000>
created_at = <Date 2003-04-11.19:12:08.000>
labels = ['build']
title = "_tkinter.c doesn't build on Redhat 9"
updated_at = <Date 2003-04-16.20:55:04.000>
user = 'https://bugs.python.org/nnorwitz'

bugs.python.org fields:

activity = <Date 2003-04-16.20:55:04.000>
actor = 'loewis'
assignee = 'loewis'
closed = True
closed_date = None
closer = None
components = ['Build']
creation = <Date 2003-04-11.19:12:08.000>
creator = 'nnorwitz'
dependencies = []
files = []
hgrepos = []
issue_num = 719880
keywords = []
message_count = 5.0
messages = ['15439', '15440', '15441', '15442', '15443']
nosy_count = 2.0
nosy_names = ['loewis', 'nnorwitz']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue719880'
versions = []

@nnorwitz
Copy link
Mannequin Author

nnorwitz mannequin commented Apr 11, 2003

Martin, _tkinter doesn't build on Redhat 9 because:
_tkinter.c:92:2: #error "unsupported Tcl configuration"

TCL_UTF_MAX is defined to be 6, not 3. I don't know
what else would be necessary to change to get this to
work. Can you provide any ideas?

I changed line 92 to:

    #if TCL_UTF_MAX != 3 && TCL_UTF_MAX != 6

and I was able to bring a window up with a push button.

@nnorwitz nnorwitz mannequin closed this as completed Apr 11, 2003
@nnorwitz nnorwitz mannequin assigned loewis Apr 11, 2003
@nnorwitz nnorwitz mannequin added the build The build process and cross-build label Apr 11, 2003
@nnorwitz nnorwitz mannequin closed this as completed Apr 11, 2003
@nnorwitz nnorwitz mannequin assigned loewis Apr 11, 2003
@nnorwitz nnorwitz mannequin added the build The build process and cross-build label Apr 11, 2003
@loewis
Copy link
Mannequin

loewis mannequin commented Apr 11, 2003

Logged In: YES
user_id=21627

What Tcl version is that? I didn't know Tcl does UCS-4...

The comment says it all: Tcl_Unichar is expected to be two
bytes. If it isn't, and
a) Python is UCS-2: In AsObj, deal with surrogates in the
Python
string, combining them into a single Tcl_Unichar. In
FromObj, split
non-BMP characters into two. This means that you need a copying
loop, as you cannot expect that the size of the Tcl and Python
strings will be the same.
b) Python is UCS-4. Consider also using
PyUnicode_FromUnicode in FromObj, and NewUnicodeObj in AsObj.

Alternatively, proclaim that "Tcl is UCS-4, Python is UCS-2"
is not supported, drop case a), and perform just the direct
operations in case b) (the current copying loops are still
needed for UCS-2 Tcl).

Perhaps Tcl isn't UCS-4, but uses surrogate pairs instead?
In that case, one would need to use yet other algorithms...

@nnorwitz
Copy link
Mannequin Author

nnorwitz mannequin commented Apr 11, 2003

Logged In: YES
user_id=33168

Tcl/Tk version is 8.3.5. There were some warnings from
AsObj. I'll look into this in more detail later. I may ask
the redhat guys to take a look too.

@loewis
Copy link
Mannequin

loewis mannequin commented Apr 12, 2003

Logged In: YES
user_id=21627

I just looked at their source RPM, and I can't believe what
I'm seeing :-(

There is tcltk-8.3.5-ucs4-for-py.patch, which reads

--- tcl8.3.5/generic/tcl.h~	2003-02-04 10:01:20.000000000 +0900
+++ tcl8.3.5/generic/tcl.h	2003-02-04 10:01:20.000000000 +0900
@@ -1604,13 +1604,13 @@
  * Unicode character in UTF-8.
  */
 
-#define TCL_UTF_MAX		3
+#define TCL_UTF_MAX		6
 
 /*
  * This represents a Unicode character.  
  */
 
-typedef unsigned short Tcl_UniChar;
+typedef wchar_t Tcl_UniChar;
 
 /*
  * Deprecated Tcl procedures:

I'd say they have tricked themselves: Py22 would fail to
work with Tcl in UCS-4 mode. Instead of fixing this in
tkinter (as I did for Python 2.3), they just patched tcl...
However, Tcl itself seems to be prepared for that mode of
operation; atleast their UTF-8 codec knows how to convert 6
bytes into a single int.

I would suggest that we mandate UCS-4 on Redhat 9 (through
README), and fix it for this case (i.e. allow UTF_MAX to be
6 only if unicode is wide, and narrow the UNICODE_WIDE test
to && UTF_MAX==3).

@loewis
Copy link
Mannequin

loewis mannequin commented Apr 16, 2003

Logged In: YES
user_id=21627

I have fixed this in _tkinter.c 1.155; Python must be build
with --enable-unicode=ucs4 on Redhat 8 (I haven't actually
tested it on Redhat, but on a modified Tcl installation on
SuSE).

It turns out that Tcl isn't really prepared for UCS-4, e.g.
when trying to put \N{MATHEMATICAL BOLD FRAKTUR CAPITAL A}
into a label, it crashes when attempting to convert that
character to Latin-1 (as it made a 256x256 table, but has
the first index > 256).

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build
Projects
None yet
Development

No branches or pull requests

0 participants