diff --git a/boltons/funcutils.py b/boltons/funcutils.py
index 1a34373..17ab6d5 100644
--- a/boltons/funcutils.py
+++ b/boltons/funcutils.py
@@ -474,6 +474,7 @@ class FunctionBuilder(object):
                  'module': lambda: None,
                  'body': lambda: 'pass',
                  'indent': lambda: 4,
+                 "annotations": dict,
                  'filename': lambda: 'boltons.funcutils.FunctionBuilder'}
 
     _defaults.update(_argspec_defaults)
@@ -495,7 +496,12 @@ class FunctionBuilder(object):
     # def get_argspec(self):  # TODO
 
     if _IS_PY2:
-        def get_sig_str(self):
+        def get_sig_str(self, with_annotations=True):
+            """Return function signature as a string.
+
+            with_annotations is ignored on Python 2.  On Python 3 signature
+            will omit annotations if it is set to False.
+            """
             return inspect.formatargspec(self.args, self.varargs,
                                          self.varkw, [])
 
@@ -503,14 +509,23 @@ class FunctionBuilder(object):
             return inspect.formatargspec(self.args, self.varargs,
                                          self.varkw, [])[1:-1]
     else:
-        def get_sig_str(self):
+        def get_sig_str(self, with_annotations=True):
+            """Return function signature as a string.
+
+            with_annotations is ignored on Python 2.  On Python 3 signature
+            will omit annotations if it is set to False.
+            """
+            if with_annotations:
+                annotations = self.annotations
+            else:
+                annotations = {}
             return inspect.formatargspec(self.args,
                                          self.varargs,
                                          self.varkw,
                                          [],
                                          self.kwonlyargs,
                                          {},
-                                         self.annotations)
+                                         annotations)
 
         _KWONLY_MARKER = re.compile(r"""
         \*     # a star
@@ -552,6 +567,7 @@ class FunctionBuilder(object):
         kwargs = {'name': func.__name__,
                   'doc': func.__doc__,
                   'module': func.__module__,
+                  'annotations': getattr(func, "__annotations__", {}),
                   'dict': getattr(func, '__dict__', {})}
 
         kwargs.update(cls._argspec_to_dict(func))
@@ -590,7 +606,7 @@ class FunctionBuilder(object):
         body = _indent(self.body, ' ' * self.indent)
 
         name = self.name.replace('<', '_').replace('>', '_')  # lambdas
-        src = tmpl.format(name=name, sig_str=self.get_sig_str(),
+        src = tmpl.format(name=name, sig_str=self.get_sig_str(with_annotations=False),
                           doc=self.doc, body=body)
         self._compile(src, execdict)
         func = execdict[name]
@@ -600,6 +616,7 @@ class FunctionBuilder(object):
         func.__defaults__ = self.defaults
         if not _IS_PY2:
             func.__kwdefaults__ = self.kwonlydefaults
+            func.__annotations__ = self.annotations
 
         if with_dict:
             func.__dict__.update(self.dict)

`boltons.funcutils.wraps` breaks with Python 3 function annotations
Tested with `boltons==17.1.0`

Repro: Executing the following script fails
```python
from boltons.funcutils import wraps
from typing import Optional

def wrap_it(f):
    @wraps(f)
    def wrapper(self, *args, **kwargs):
        f(*args, **kwargs)
    return wrapper

@wrap_it
def foo(x: Optional[int]) -> Optional[int]:
    return x
```

Results in
```bash
rwilliams at rwilliams-mbp114 in ~/src/oss/boltons (master●) (venv)
$ python ../../test_wraps_with_annotations.py
Traceback (most recent call last):
  File "../../test_wraps_with_annotations.py", line 11, in <module>
    def foo(x: Optional[int]) -> Optional[int]:
  File "../../test_wraps_with_annotations.py", line 5, in wrap_it
    @wraps(f)
  File "/Users/rwilliams/src/oss/boltons/boltons/funcutils.py", line 307, in wrapper_wrapper
    fully_wrapped = fb.get_func(execdict, with_dict=update_dict)
  File "/Users/rwilliams/src/oss/boltons/boltons/funcutils.py", line 526, in get_func
    self._compile(src, execdict)
  File "/Users/rwilliams/src/oss/boltons/boltons/funcutils.py", line 590, in _compile
    exec(code, execdict)
  File "<boltons.funcutils.FunctionBuilder-0>", line 1, in <module>
NameError: name 'Union' is not defined
```
diff --git a/tests/test_funcutils_fb_py3.py b/tests/test_funcutils_fb_py3.py
index 3effd7e..d0b4a79 100644
--- a/tests/test_funcutils_fb_py3.py
+++ b/tests/test_funcutils_fb_py3.py
@@ -1,5 +1,6 @@
 
 import inspect
+from collections import defaultdict
 
 import pytest
 
@@ -20,12 +21,13 @@ def pita_wrap(flag=False):
 def test_wraps_py3():
 
     @pita_wrap(flag=True)
-    def annotations(a: int, b: float=1) -> "tuple":
-        return a, b
+    def annotations(a: int, b: float=1, c: defaultdict=()) -> defaultdict:
+        return a, b, c
 
-    annotations(0) == (True, "annotations", (0, 1))
-    annotations.__annotations__ == {'a': int, 'b': float,
-                                    'return': 'tuple'}
+    assert annotations(0) == (True, "annotations", (0, 1, ()))
+    assert annotations.__annotations__ == {'a': int, 'b': float,
+                                           'c': defaultdict,
+                                           'return': defaultdict}
 
     @pita_wrap(flag=False)
     def kwonly_arg(a, *, b, c=2):
@@ -34,8 +36,8 @@ def test_wraps_py3():
     with pytest.raises(TypeError):
         kwonly_arg(0)
 
-    kwonly_arg(0, b=1) == (False, "kwonly_arg", (0, 1, 2))
-    kwonly_arg(0, b=1, c=3) == (False, "kwonly_arg", (0, 1, 3))
+    assert kwonly_arg(0, b=1) == (False, "kwonly_arg", (0, 1, 2))
+    assert kwonly_arg(0, b=1, c=3) == (False, "kwonly_arg", (0, 1, 3))
 
     @pita_wrap(flag=True)
     def kwonly_non_roundtrippable_repr(*, x=lambda y: y + 1):

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio
3.7
requirements-test.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
-e git+https://github.com/mahmoud/boltons.git@761a8477ba9f0372a4415c588846fd6aa1fb1521#egg=boltons
certifi @ file:///croot/certifi_1671487769961/work/certifi
coverage==4.5.1
exceptiongroup==1.2.2
execnet==2.0.2
importlib-metadata==6.7.0
iniconfig==2.0.0
packaging==24.0
pluggy==0.13.1
py==1.5.4
pytest==7.4.4
pytest-asyncio==0.21.2
pytest-cov==2.5.1
pytest-mock==3.11.1
pytest-xdist==3.5.0
six==1.17.0
tomli==2.0.1
tox==2.9.1
tox-virtualenv-no-download==1.0.2
typing_extensions==4.7.1
virtualenv==15.0.2
zipp==3.15.0

name: boltons
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - coverage==4.5.1
      - exceptiongroup==1.2.2
      - execnet==2.0.2
      - importlib-metadata==6.7.0
      - iniconfig==2.0.0
      - packaging==24.0
      - pluggy==0.13.1
      - py==1.5.4
      - pytest==7.4.4
      - pytest-asyncio==0.21.2
      - pytest-cov==2.5.1
      - pytest-mock==3.11.1
      - pytest-xdist==3.5.0
      - six==1.17.0
      - tomli==2.0.1
      - tox==2.9.1
      - tox-virtualenv-no-download==1.0.2
      - typing-extensions==4.7.1
      - virtualenv==15.0.2
      - zipp==3.15.0
prefix: /opt/conda/envs/boltons

tests/test_funcutils_fb_py3.py::test_wraps_py3
tests/test_funcutils_fb_py3.py::test_remove_kwonly_arg tests/test_funcutils_fb_py3.py::test_FunctionBuilder_KWONLY_MARKER[a, tests/test_funcutils_fb_py3.py::test_FunctionBuilder_KWONLY_MARKER[a,*,b-True] tests/test_funcutils_fb_py3.py::test_FunctionBuilder_KWONLY_MARKER[*args-False] tests/test_funcutils_fb_py3.py::test_FunctionBuilder_KWONLY_MARKER[*args, tests/test_funcutils_fb_py3.py::test_FunctionBuilder_add_arg_kwonly
boltons/funcutils.py
boltons/funcutils.py