sphinx-doc / sphinx-doc/sphinx

Reference target not found: _thread.allocate_loc

Open
#9,338 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:bug
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
If I use sphinx with autodoc and a typing hint on lock, I get the nitpick error:
picky/picky/__init__.py:docstring of picky.do_lock::py:class reference target not found: _thread.allocate_loc

To Reproduce

setup

virtualenv venv --python=python3.7
source venv/bin/activate
pip install Sphinx==4.0.2

docs/conf.py

import os
import sys
sys.path.insert(0, os.path.abspath('..'))
extensions = ["sphinx.ext.autodoc"]

docs/index.rst

PICKY
=====

.. automodule:: picky
   :members:
   :undoc-members:
   :show-inheritance:

picky/__init__.py

import threading
def do_lock(lock: threading.Lock):
    """dummy"""
    pass

Build

rm -rf docs/_build/ && sphinx-build -b html -W -n -a  docs docs/_build/

Expected behavior
It should work fine

Environment info

  • OS: Linux
  • Python version: 3.7.1
  • Sphinx version: 4.0.2
  • Sphinx extensions: sphinx.ext.autodoc

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the warning with docs/conf.py, docs/index.rst, and picky/init.py using the stated Python and Sphinx versions. Trace how autodoc handles the threading.Lock annotation and add a regression test for the example; done means sphinx-build -b html -W -n completes without the missing _thread.allocate_loc target warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.