~pythonregexp2.7/python/issue2636-11

« back to all changes in this revision

Viewing changes to Lib/test/test_scope.py

  • Committer: Jeffrey C. "The TimeHorse" Jacobs
  • Date: 2008-09-21 17:53:26 UTC
  • mfrom: (39025.1.14 Regexp-2.7)
  • Revision ID: darklord@timehorse.com-20080921175326-92vaej2hc3yuecxb
Merged in changes from the core Regexp branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
519
519
        self.assert_("x" not in varnames)
520
520
        self.assert_("y" in varnames)
521
521
 
 
522
    def testLocalsClass_WithTrace(self):
 
523
        # Issue23728: after the trace function returns, the locals()
 
524
        # dictionary is used to update all variables, this used to
 
525
        # include free variables. But in class statements, free
 
526
        # variables are not inserted...
 
527
        import sys
 
528
        sys.settrace(lambda a,b,c:None)
 
529
        try:
 
530
            x = 12
 
531
 
 
532
            class C:
 
533
                def f(self):
 
534
                    return x
 
535
 
 
536
            self.assertEquals(x, 12) # Used to raise UnboundLocalError
 
537
        finally:
 
538
            sys.settrace(None)
 
539
 
522
540
    def testBoundAndFree(self):
523
541
        # var is bound and free in class
524
542