Opened 4 years ago

Closed 3 years ago

#22147 closed defect (fixed)

pyport.h from python2.7 sometimes clashes with c++ functions on OS X

Reported by: fbissey Owned by:
Priority: blocker Milestone: sage-duplicate/invalid/wontfix
Component: packages: standard Keywords:
Cc: Merged in:
Authors: Reviewers: François Bissey
Report Upstream: N/A Work issues:
Branch: u/fbissey/pyport (Commits) Commit: 502aff0910d7983e7dd849d614e84cf97307e576
Dependencies: Stopgaps:


The recent upgrade to pynac-0.7.3 brought a flurry of compiling problem on OS X with the following kind of message

  CXX      libpynac_la-sum.lo
In file included from /Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-7.5.rc2/local/include/c++/5.4.0/bits/basic_ios.h:37:0,
                 from /Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-7.5.rc2/local/include/c++/5.4.0/ios:44,
                 from /Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-7.5.rc2/local/include/c++/5.4.0/ostream:38,
                 from /Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-7.5.rc2/local/include/c++/5.4.0/iostream:39,
                 from class_info.h:31,
                 from registrar.h:30,
                 from basic.h:40,
                 from numeric.h:49,
                 from inifcns.h:26,
                 from sum.cpp:13:
/Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-7.5.rc2/local/include/c++/5.4.0/bits/locale_facets.h:247:53: error: macro "toupper" passed 2 arguments, but takes just 1
       toupper(char_type *__lo, const char_type* __hi) const

This is caused by definition of macros for toupper and other functions in pyport.h specifically on OS X. This is unsafe with C++ and the issue has been known in MacPort? for years:

We should adopt their patch for python.

Change History (9)

comment:1 Changed 4 years ago by fbissey

  • Authors set to François Bissey
  • Branch set to u/fbissey/pyport
  • Commit set to 502aff0910d7983e7dd849d614e84cf97307e576
  • Status changed from new to needs_review

Python3 should be checked over as well.

New commits:

502aff0Adopt macport patch for pyport interference with C++ on OS X trac #22147

comment:2 Changed 4 years ago by fbissey

I note that the upstream python issue is marked closed while there was never really a good solution in my opinion. Anyone can do something about this issue? Can it be re-opened, or do we need a new one.

comment:3 follow-up: Changed 4 years ago by jdemeyer

The Python issue was fixed in Python 2.7.13, so could it be that #22037 also fixes the problem?

comment:4 in reply to: ↑ 3 Changed 4 years ago by fbissey

Replying to jdemeyer:

The Python issue was fixed in Python 2.7.13, so could it be that #22037 also fixes the problem?

Depends what's in pyport.h, I cannot see any commit being linked to issue 10910. I can have a look at #22037 which would then be a preferred option to this ticket, but I am running out of time.

comment:5 Changed 4 years ago by fbissey

I just checked the python 2.7.13 tarball and the fix is in. So yes #22037 will fix the issue.

Last edited 4 years ago by fbissey (previous) (diff)

comment:6 Changed 4 years ago by fbissey

I won't be able to deal with this since I'll be off for a week. I am ok for this ticket to be marked duplicate and #22037 to be marked blocker instead. I see it is needing review so I am guessing it is good to go.

comment:7 Changed 4 years ago by jdemeyer

  • Authors François Bissey deleted
  • Milestone changed from sage-7.5 to sage-duplicate/invalid/wontfix
  • Reviewers set to François Bissey
  • Status changed from needs_review to positive_review

comment:8 Changed 4 years ago by vbraun

Still don't understand why it works on the OSX buildbot, oh well...

comment:9 Changed 3 years ago by vbraun

  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.