# Buggy code
def upload_distribution():
    """Upload the built package to crates.io."""
    tools.assert_can_release()

    # Yes, cargo really will only look in this file. Yes this is terrible.
    # This only runs on Travis, so we may be assumed to own it, but still.
    unlink_if_present(CARGO_CREDENTIALS)

    # symlink so that the actual secret credentials can't be leaked via the
    # cache.
    os.symlink(tools.CARGO_API_KEY, CARGO_CREDENTIALS)

    # Give the key the right permissions.
    os.chmod(CARGO_CREDENTIALS, int("0600", 8))

    cargo("publish")


# Traceback (AttributeError)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "...\hypothesis\strategies\_internal\strategies.py", line 314, in example
example_generating_inner_function()
File "...\hypothesis\strategies\_internal\strategies.py", line 302, in example_generating_inner_function
@settings(
File "...\hypothesis\core.py", line 1023, in wrapped_test
processed_args = process_arguments_to_given(
File "...\hypothesis\core.py", line 441, in process_arguments_to_given
search_strategy.validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 377, in validate
self.do_validate()
File "...\hypothesis\strategies\_internal\collections.py", line 39, in do_validate
s.validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 377, in validate
self.do_validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 638, in do_validate
self.mapped_strategy.validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 377, in validate
self.do_validate()
File "...\hypothesis\strategies\_internal\lazy.py", line 118, in do_validate
w.validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 377, in validate
self.do_validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 638, in do_validate
self.mapped_strategy.validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 377, in validate
self.do_validate()
File "...\hypothesis\strategies\_internal\collections.py", line 39, in do_validate
s.validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 377, in validate
self.do_validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 595, in do_validate
for e in self.element_strategies:
File "...\hypothesis\strategies\_internal\strategies.py", line 570, in element_strategies
if not arg.is_empty:
File "...\hypothesis\strategies\_internal\strategies.py", line 125, in accept
recur(self)
File "...\hypothesis\strategies\_internal\strategies.py", line 121, in recur
mapping[strat] = getattr(strat, calculation)(recur)
File "...\hypothesis\strategies\_internal\lazy.py", line 86, in calc_is_empty
return recur(self.wrapped_strategy)
File "...\hypothesis\strategies\_internal\strategies.py", line 121, in recur
mapping[strat] = getattr(strat, calculation)(recur)
File "...\hypothesis\strategies\_internal\deferred.py", line 80, in calc_is_empty
return recur(self.wrapped_strategy)
File "...\hypothesis\strategies\_internal\deferred.py", line 55, in wrapped_strategy
del self.__definition
AttributeError: _DeferredStrategy__definition

# Fixed code
def upload_distribution():
    """Upload the built package to crates.io."""
    tools.assert_can_release()

    # Yes, cargo really will only look in this file. Yes this is terrible.
    # This only runs in CI, so we may be assumed to own it, but still.
    unlink_if_present(CARGO_CREDENTIALS)

    # symlink so that the actual secret credentials can't be leaked via the
    # cache.
    os.symlink(tools.CARGO_API_KEY, CARGO_CREDENTIALS)

    # Give the key the right permissions.
    os.chmod(CARGO_CREDENTIALS, int("0600", 8))

    cargo("publish")