Ticket #5779 enhancement closed fixed

Opened 10 months ago

Last modified 10 months ago

Conch relies on a CPython implementation detail

Reported by: Alex Owned by:
Priority: normal Milestone:
Component: conch Keywords:
Cc: z3p Branch: branches/conch-should-not-use-builtins-5779
Author: cyli Launchpad Bug:

Description

It uses __builtins__ and assumes that it will be a dict. According to  http://docs.python.org/library/__builtin__.html this is a) an implementation detail of CPython, and b) not guaranteed to be a dict! it will sometimes be a module.

Attachments

t5779-builtins.diff Download (0.6 KB) - added by Alex 10 months ago.

Change History

1

Changed 10 months ago by DefaultCC Plugin

  • cc z3p added

Changed 10 months ago by Alex

2

Changed 10 months ago by Alex

  • keywords review added

3

Changed 10 months ago by cyli

  • branch set to branches/conch-should-not-use-builtins-5779
  • branch_author set to cyli

(In [34803]) Branching to 'conch-should-not-use-builtins-5779'

4

Changed 10 months ago by spiv

I suppose strictly speaking this is correct, but:

  • is gmpy even available for non-CPython interpreters, and
  • if it is available, are we sure it's faster?

e.g. I'm wondering if for pypy we'd be better off not doing this hack. I guess optimising exponentiation isn't pypy's focus, but who knows…

Anyway, this patch does seem to be slightly more correct in theory, so we may as well use it :)

5

Changed 10 months ago by cyli

(In [34804]) Apply Alex's t5779-builtins.diff patch refs #5779

6

Changed 10 months ago by Alex

spiv: No, it's not, and in fact from reading the source I seriously doubt it will ever compile against either CPyExt (PyPy's compatibility layer) or IronClad (IronPython). This was submitted purely as a correctness issue, not a compatibility one.

7

Changed 10 months ago by cyli

(In [34807]) Add a newsfile refs #5779

8

Changed 10 months ago by cyli

Thanks for finding and fixing this Alex! In the future, could you also include a news file in your patch? http://twistedmatrix.com/trac/wiki/ReviewProcess#Newsfiles

 buildbot tests pass. Merging this.

9

Changed 10 months ago by cyli

  • status changed from new to closed
  • resolution set to fixed

(In [34811]) Merge conch-should-not-use-builtins-5779: conch should not depend on builtlins being a dict

Author: Alex Reviewer: cyli, spiv Fixes: #5779

Conch uses builtins and assumes that it will be a dict, which is an implementation of CPython and not guaranteed to dict instead of a module

10

Changed 10 months ago by cyli

  • keywords review removed

Oops, forgot to remove review keyword

Note: See TracTickets for help on using tickets.