Skip to content

build: protect _working_directory with lock to make build thread-safe#535

Closed
radoering wants to merge 1 commit into
pypa:mainfrom
radoering:thread-safe-build
Closed

build: protect _working_directory with lock to make build thread-safe#535
radoering wants to merge 1 commit into
pypa:mainfrom
radoering:thread-safe-build

Conversation

@radoering

Copy link
Copy Markdown
Contributor

In python-poetry/poetry#6205, we noticed that running multiple builds in parallel is not thread-safe because build changes the working directory at some places. Of course, downstream users can protect calls to build with locks by themselves but it might be nice to not have to worry about it.

@layday

layday commented Nov 20, 2022 via email

Copy link
Copy Markdown
Member

@layday

layday commented Nov 20, 2022

Copy link
Copy Markdown
Member

I'm quite certain this is redundant. _working_dir is only called once in ProjectBuilder._handle_backend. _handle_backend is only ever called with a PEP 517 hook. pyproject-hooks (formerly pep517) sets the cwd on the subprocess runner whenever it invokes a hook in https://github.com/pypa/pyproject-hooks/blob/5b5b66bc559bdf0d9c65979b784ab4d34f0662df/src/pyproject_hooks/_impl.py#L313 and it's always done that.

@radoering

Copy link
Copy Markdown
Contributor Author

According to #79 and #68, I suppose it was at least necessary at that time.

@layday

layday commented Nov 20, 2022

Copy link
Copy Markdown
Member

I think the issue then was that the source directory wasn't an absolute path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants