/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzr

  • Committer: John Arbash Meinel
  • Date: 2009-10-13 16:44:43 UTC
  • mto: This revision was merged to the branch mainline in revision 4741.
  • Revision ID: john@arbash-meinel.com-20091013164443-b92lnyiir2ucyguj
Stop using hash() because of bugs wrt pyrex 0.9.8.5

Rather than going directly to the Py_TYPE() object, I also use PyObject_Hash()
everywhere now. This simplifies the code a little bit, as I can declare it
returns -1 as an exception, rather than having to manually check the return
value.

What is really strange is that pyrex 0.9.7.2 gets it right, strange
regression to have. cython 0.11.3 also gets it right, but I don't know
that all versions of cython handle it correctly, either.


The main problem is that we are mixing, and then comparing
'other_hash = this_hash'. If we always used the 32-bit form, we would
be okay for our purposes, or always use the 64-bit form. I'm focusing
on the latter.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /usr/bin/env python
2
2
 
3
 
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Canonical Ltd
 
3
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
4
4
#
5
5
# This program is free software; you can redistribute it and/or modify
6
6
# it under the terms of the GNU General Public License as published by
23
23
import warnings
24
24
 
25
25
# update this on each release
26
 
_script_version = (2, 2, 0)
 
26
_script_version = (2, 1, 0)
27
27
 
 
28
if __doc__ is None:
 
29
    print "bzr does not support python -OO."
 
30
    sys.exit(2)
28
31
try:
29
32
    version_info = sys.version_info
30
33
except AttributeError:
135
138
 
136
139
 
137
140
if __name__ == '__main__':
138
 
    bzrlib.initialize()
 
141
    bzrlib.trace.enable_default_logging()
139
142
    exit_val = bzrlib.commands.main()
140
143
 
141
144
    if profiling:
142
145
        profile_imports.log_stack_info(sys.stderr)
143
146
 
 
147
    # run anything registered by atexit, because it won't be run in the normal
 
148
    # way
 
149
    sys.exitfunc()
 
150
 
144
151
    # By this point we really have completed everything we want to do, and
145
152
    # there's no point doing any additional cleanup.  Abruptly exiting here
146
153
    # stops any background threads getting into trouble as code is unloaded,
148
155
    # are just about to be discarded anyhow.  This does mean that atexit hooks
149
156
    # won't run but we don't use them.  Also file buffers won't be flushed,
150
157
    # but our policy is to always close files from a finally block. -- mbp 20070215
151
 
    sys.exitfunc()
 
158
    try:
 
159
        sys.stdout.flush()
 
160
        sys.stderr.flush()
 
161
    except IOError, e:
 
162
        import errno
 
163
        if e.errno in [errno.EINVAL, errno.EPIPE]:
 
164
            pass
 
165
        else:
 
166
            raise
 
167
    if bzrlib.trace._trace_file:
 
168
        # this is also _bzr_log
 
169
        bzrlib.trace._trace_file.flush()
152
170
    os._exit(exit_val)
153
171
else:
154
172
    raise ImportError("The bzr script cannot be imported.")